Class TransferZoneHelper
- java.lang.Object
-
- org.goplanit.osm.converter.zoning.handler.helper.TransferZoneHelper
-
public class TransferZoneHelper extends Object
Class to provide functionality for parsing transfer zones from OSM entities- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description TransferZoneHelper(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TransferZone
createAndRegisterTransferZoneWithConnectoidsAtOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, String defaultOsmMode, TransferZoneType defaultTransferZoneType, PlanitJtsCrsUtils geoUtils)
Method that will attempt to create both a transfer zone and its connectoids at the location of the OSM node.TransferZone
createAndRegisterTransferZoneWithoutConnectoidsFindAccessModes(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Map<String,String> tags, TransferZoneType transferZoneType, String defaultOsmMode, PlanitJtsCrsUtils geoUtils)
Attempt to create a new transfer zone and register it, do not yet create connectoids for it.TransferZone
createAndRegisterTransferZoneWithoutConnectoidsSetAccessModes(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Map<String,String> tags, TransferZoneType transferZoneType, Collection<String> eligibleOsmModes, PlanitJtsCrsUtils geoUtils)
Attempt to create a new transfer zone and register it, do not create connectoids for it.Set<TransferZone>
filterModeCompatibleTransferZones(Collection<String> eligibleOsmModes, Collection<TransferZone> potentialTransferZones, boolean allowPseudoModeMatches)
Find all transfer zones with at least one compatible mode (and PLANit mode mapped) based on the passed in reference osm modes In case no eligible modes are provided (null), we allow any transfer zone with at least one valid mapped modeCollection<TransferZone>
findTransferZonesForStopPosition(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<String> eligibleOsmModes)
Identical to the one with transfer zone group parameter, only here no stop_position is not part of transfer zone group and therefore we only can find matches spatiallyCollection<TransferZone>
findTransferZonesForStopPosition(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<String> eligibleOsmModes, TransferZoneGroup transferZoneGroup)
Find the transfer zone(s) for a given stop_position, either the user overwritten mapping, or conditioned on mode,reference/name/spatially, or just the closest one in absence of eligible modes.protected OsmNetworkToZoningReaderData
getNetworkToZoningData()
collect network to zoning data from settingsprotected OsmPublicTransportReaderSettings
getSettings()
Collect the pt settingsprotected boolean
hasNetworkLayersWithActiveOsmNode(long osmNodeId)
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit link
-
-
-
Constructor Detail
-
TransferZoneHelper
public TransferZoneHelper(Zoning zoning, OsmZoningReaderData zoningReaderData, OsmPublicTransportReaderSettings transferSettings, OsmZoningHandlerProfiler profiler)
Constructor- Parameters:
zoning
- to usezoningReaderData
- to usetransferSettings
- to useprofiler
- to use
-
-
Method Detail
-
filterModeCompatibleTransferZones
public Set<TransferZone> filterModeCompatibleTransferZones(Collection<String> eligibleOsmModes, Collection<TransferZone> potentialTransferZones, boolean allowPseudoModeMatches)
Find all transfer zones with at least one compatible mode (and PLANit mode mapped) based on the passed in reference osm modes In case no eligible modes are provided (null), we allow any transfer zone with at least one valid mapped mode- Parameters:
eligibleOsmModes
- to map against (may be null)potentialTransferZones
- to extract mode compatible transfer zonesallowPseudoModeMatches
- , when true only broad category needs to match, i.e., both have a road/rail/water mode, when false only exact matches are allowed- Returns:
- matched transfer zones
-
createAndRegisterTransferZoneWithoutConnectoidsFindAccessModes
public TransferZone createAndRegisterTransferZoneWithoutConnectoidsFindAccessModes(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Map<String,String> tags, TransferZoneType transferZoneType, String defaultOsmMode, PlanitJtsCrsUtils geoUtils) throws PlanItException
Attempt to create a new transfer zone and register it, do not yet create connectoids for it. This is postponed because likely at this point in time it is not possible to best determine where they should reside. Find eligible access modes as input properties as well which can be used later to map stop_positions more easily. Note that one can provide a default osm mode that is deemed eligible in case no tags are provided on the osm entity. In case no mode information can be extracted a warning is issued but the transfer zone is still created because this is a tagging error and we might be able to salvage later on. If there are osm modes but none of them are mapped, then we should not create the zone since it will not be of use.- Parameters:
osmEntity
- to extract transfer zone fortags
- to usetransferZoneType
- to applydefaultOsmMode
- to applygeoUtils
- to use- Returns:
- transfer zone created, null if something happened making it impossible or not useful to create the zone
- Throws:
PlanItException
- thrown if error
-
createAndRegisterTransferZoneWithoutConnectoidsSetAccessModes
public TransferZone createAndRegisterTransferZoneWithoutConnectoidsSetAccessModes(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Map<String,String> tags, TransferZoneType transferZoneType, Collection<String> eligibleOsmModes, PlanitJtsCrsUtils geoUtils) throws PlanItException
Attempt to create a new transfer zone and register it, do not create connectoids for it. Register the provided access modes as eligible by setting them on the input properties which can be used later to map stop_positions more easily.- Parameters:
osmEntity
- to extract transfer zone fortags
- to usetransferZoneType
- to applyeligibleOsmModes
- the eligible osm modes consideredgeoUtils
- to use- Returns:
- transfer zone created, null if something happened making it impossible to create the zone
- Throws:
PlanItException
- thrown if error
-
createAndRegisterTransferZoneWithConnectoidsAtOsmNode
public TransferZone createAndRegisterTransferZoneWithConnectoidsAtOsmNode(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, String defaultOsmMode, TransferZoneType defaultTransferZoneType, PlanitJtsCrsUtils geoUtils) throws PlanItException
Method that will attempt to create both a transfer zone and its connectoids at the location of the OSM node. This is only relevant for very specific types of OSM pt nodes, such as tram_stop, some bus_stops that are tagged on the road, and potentially halts and/or stations. In case no existing transfer zone in this location exists, we create one first using the default transfer zone type provided, otherwise we utilise the existing transfer zone- Parameters:
osmNode
- for the location to create both a transfer zone and connectoid(s)tags
- of the nodedefaultOsmMode
- that is to be expected heredefaultTransferZoneType
- in case a transfer zone needs to be created in this locationgeoUtils
- to use- Returns:
- created transfer zone (if not already in existence)
- Throws:
PlanItException
- thrown if error
-
findTransferZonesForStopPosition
public Collection<TransferZone> findTransferZonesForStopPosition(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<String> eligibleOsmModes, TransferZoneGroup transferZoneGroup) throws PlanItException
Find the transfer zone(s) for a given stop_position, either the user overwritten mapping, or conditioned on mode,reference/name/spatially, or just the closest one in absence of eligible modes. In the special case the stop_position is in fact also the transfer zone and none is present we create a new TransferZone- Parameters:
osmNode
- representing the stop_locationtags
- of the nodeeligibleOsmModes
- eligible modes for the stop_location, may be nulltransferZoneGroup
- the node belongs to, may be null- Returns:
- found transfer zone matches, can be multiple if multiple are serviced by the same stop position
- Throws:
PlanItException
- thrown if error
-
findTransferZonesForStopPosition
public Collection<TransferZone> findTransferZonesForStopPosition(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags, Collection<String> eligibleOsmModes) throws PlanItException
Identical to the one with transfer zone group parameter, only here no stop_position is not part of transfer zone group and therefore we only can find matches spatially- Parameters:
osmNode
- representing the stop_locationtags
- of the nodeeligibleOsmModes
- eligible modes for the stop_location, may be null- Returns:
- found transfer zone matches
- Throws:
PlanItException
- thrown if error
-
getSettings
protected OsmPublicTransportReaderSettings getSettings()
Collect the pt settings- Returns:
- pulibc transport settings
-
getNetworkToZoningData
protected OsmNetworkToZoningReaderData getNetworkToZoningData()
collect network to zoning data from settings- Returns:
- network to zoning data
-
hasNetworkLayersWithActiveOsmNode
protected boolean hasNetworkLayersWithActiveOsmNode(long osmNodeId) throws PlanItException
Verify if there exist any layers where the node is active either as an extreme node or internal to a PLANit link- Parameters:
osmNodeId
- to use- Returns:
- true when one or more layers are found, false otherwise
- Throws:
PlanItException
- thrown if error
-
-