Package org.goplanit.osm.util
Class PlanitTransferZoneUtils
- java.lang.Object
-
- org.goplanit.osm.util.PlanitTransferZoneUtils
-
public class PlanitTransferZoneUtils extends Object
Static helper methods to support parsing/functionality of PLANit TransferZones- Author:
- markr
-
-
Constructor Summary
Constructors Constructor Description PlanitTransferZoneUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.locationtech.jts.linearref.LinearLocation
extractClosestProjectedLinearLocationOnEdgeForTransferZone(TransferZone transferZone, Edge accessEdge, PlanitJtsCrsUtils geoUtils)
Find the linear location reflecting the closest projected location between the transfer zone and link geometries.static de.topobyte.osm4j.core.model.iface.EntityType
extractOsmEntityType(TransferZone transferZone)
Extract the OSM entity type from a PLANit Transfer zonestatic TransferZoneType
extractTransferZoneTypeFromPtv1Tags(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags)
Collect the transfer zone type based on the tagsstatic TransferZone
findTransferZoneClosestByTransferGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Collection<? extends TransferZoneGroup> transferZoneGroups, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, PlanitJtsCrsUtils geoUtils)
Find the zone (within any of the transfer zone groups) closest to the passed in OSM Entitystatic Collection<String>
getRegisteredOsmModesForTransferZone(TransferZone transferZone)
Collect any prior registered eligible OSM modes on a PLANit transfer zone (unmodifiable)static String
getTransferZoneStationName(TransferZone transferZone)
Collect the station name for a transfer zone (if any)static Collection<EdgeSegment>
identifyInvalidTransferZoneAccessLinkSegmentsBasedOnRelativeLocationToInfrastructure(Collection<EdgeSegment> accessLinkSegments, TransferZone transferZone, Mode planitMode, boolean leftHandDrive, PlanitJtsCrsUtils geoUtils)
Find the access link segments ineligible given the intended location of the to be created connectoid, the transfer zone provided, and the access mode.static boolean
isTransferZoneAtLocation(TransferZone transferZone, org.locationtech.jts.geom.Point location)
Verify if the geometry of the transfer zone equates to the provided locationstatic boolean
isTransferZoneLeftOf(TransferZone transferZone, org.locationtech.jts.geom.Coordinate coordA, org.locationtech.jts.geom.Coordinate coordB, PlanitJtsCrsUtils geoUtils)
Verify of the transfer zone resides left of the line coordA to coordBstatic void
registerOsmModesOnTransferZone(TransferZone transferZone, Collection<String> eligibleOsmModes)
While PLANit does not require access modes on transfer zones because it is handled by connectoids, OSM stop_positions (connectoids) might lack the required tagging to identify their mode access in which case we revert to the related transfer zone to deduce it.static void
updateTransferZoneStationName(TransferZone transferZone, Map<String,String> tags)
process an osm entity that is classified as a (train) station.
-
-
-
Method Detail
-
findTransferZoneClosestByTransferGroup
public static TransferZone findTransferZoneClosestByTransferGroup(de.topobyte.osm4j.core.model.iface.OsmEntity osmEntity, Collection<? extends TransferZoneGroup> transferZoneGroups, Map<Long,de.topobyte.osm4j.core.model.iface.OsmNode> osmNodes, PlanitJtsCrsUtils geoUtils) throws PlanItException
Find the zone (within any of the transfer zone groups) closest to the passed in OSM Entity- Parameters:
osmEntity
- to find closest zone fortransferZoneGroups
- to check againstosmNodes
- to extract geo information from if neededgeoUtils
- used to compute distances- Returns:
- closest zone found
- Throws:
PlanItException
- thrown if error
-
isTransferZoneAtLocation
public static boolean isTransferZoneAtLocation(TransferZone transferZone, org.locationtech.jts.geom.Point location) throws PlanItException
Verify if the geometry of the transfer zone equates to the provided location- Parameters:
transferZone
- to verifylocation
- to verify against- Returns:
- true when residing at the exact same location at the reference location, false otherwise
- Throws:
PlanItException
- thrown if error
-
isTransferZoneLeftOf
public static boolean isTransferZoneLeftOf(TransferZone transferZone, org.locationtech.jts.geom.Coordinate coordA, org.locationtech.jts.geom.Coordinate coordB, PlanitJtsCrsUtils geoUtils) throws PlanItException
Verify of the transfer zone resides left of the line coordA to coordB- Parameters:
transferZone
- to checkcoordA
- of linecoordB
- of linegeoUtils
- to use- Returns:
- true when left, false otherwise
- Throws:
PlanItException
- thrown if error
-
identifyInvalidTransferZoneAccessLinkSegmentsBasedOnRelativeLocationToInfrastructure
public static Collection<EdgeSegment> identifyInvalidTransferZoneAccessLinkSegmentsBasedOnRelativeLocationToInfrastructure(Collection<EdgeSegment> accessLinkSegments, TransferZone transferZone, Mode planitMode, boolean leftHandDrive, PlanitJtsCrsUtils geoUtils) throws PlanItException
Find the access link segments ineligible given the intended location of the to be created connectoid, the transfer zone provided, and the access mode. When transfer zone location differs from the connectoid location determine on which side of the infrastructure it exists and based on the country's driving direction and access mode determine the access link segments- Parameters:
accessLinkSegments
- to filtertransferZone
- to create connectoid(s) forplanitMode
- that is accessibleleftHandDrive
- is infrastructure left hand drive or notgeoUtils
- to use for determining geographic eligibility- Returns:
- ineligible link segments to be access link segments for connectoid at this location
- Throws:
PlanItException
- thrown if error
-
updateTransferZoneStationName
public static void updateTransferZoneStationName(TransferZone transferZone, Map<String,String> tags)
process an osm entity that is classified as a (train) station. For this to register on the transfer zone, we try to utilise its name and use it for the zone name if it is empty. We also record it as an input property for future reference, e.g. key=station and value the name of the osm station- Parameters:
transferZone
- the osm station relates totags
- of the osm entity representation a station
-
registerOsmModesOnTransferZone
public static void registerOsmModesOnTransferZone(TransferZone transferZone, Collection<String> eligibleOsmModes)
While PLANit does not require access modes on transfer zones because it is handled by connectoids, OSM stop_positions (connectoids) might lack the required tagging to identify their mode access in which case we revert to the related transfer zone to deduce it. Therefore, we store OSM mode information on a transfer zone via the generic input properties to be able to retrieve it if needed later- Parameters:
transferZone
- to useeligibleOsmModes
- to add
-
getRegisteredOsmModesForTransferZone
public static Collection<String> getRegisteredOsmModesForTransferZone(TransferZone transferZone)
Collect any prior registered eligible OSM modes on a PLANit transfer zone (unmodifiable)- Parameters:
transferZone
- to collect from- Returns:
- eligible OSM modes, null if none
-
getTransferZoneStationName
public static String getTransferZoneStationName(TransferZone transferZone)
Collect the station name for a transfer zone (if any)- Parameters:
transferZone
- to collect for- Returns:
- station name
-
extractOsmEntityType
public static de.topobyte.osm4j.core.model.iface.EntityType extractOsmEntityType(TransferZone transferZone) throws PlanItException
Extract the OSM entity type from a PLANit Transfer zone- Parameters:
transferZone
- to identify entity type for- Returns:
- the entity type
- Throws:
PlanItException
- thrown if error
-
extractClosestProjectedLinearLocationOnEdgeForTransferZone
public static org.locationtech.jts.linearref.LinearLocation extractClosestProjectedLinearLocationOnEdgeForTransferZone(TransferZone transferZone, Edge accessEdge, PlanitJtsCrsUtils geoUtils) throws PlanItException
Find the linear location reflecting the closest projected location between the transfer zone and link geometries. For the transfer zone geometry we use existing coordinates rather than projected ones- Parameters:
transferZone
- to useaccessEdge
- to usegeoUtils
- to use- Returns:
- closest projected linear location on link geometry
- Throws:
PlanItException
- thrown if error
-
extractTransferZoneTypeFromPtv1Tags
public static TransferZoneType extractTransferZoneTypeFromPtv1Tags(de.topobyte.osm4j.core.model.iface.OsmNode osmNode, Map<String,String> tags)
Collect the transfer zone type based on the tags- Parameters:
osmNode
- nodetags
- tags of the node- Returns:
- transfer zone type, unknown if not able to map
-
-