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 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, boolean suppressLogging, PlanitJtsCrsUtils geoUtils)
Find the zone (within any of the transfer zone groups) closest to the passed in OSM Entitystatic SortedSet<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 boolean
isTransferZoneAtLocation(TransferZone transferZone, org.locationtech.jts.geom.Point location)
Verify if the geometry of the transfer zone equates to the provided locationstatic void
registerOsmModesOnTransferZone(TransferZone transferZone, SortedSet<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 de.topobyte.osm4j.core.model.iface.EntityType
transferZoneGeometryToOsmEntityType(org.locationtech.jts.geom.Geometry transferZoneGeometry)
Extract the OSM entity type from a PLANit Transfer zonestatic 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, boolean suppressLogging, PlanitJtsCrsUtils geoUtils)
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 neededsuppressLogging
- when true suppress logging, false otherwisegeoUtils
- used to compute distances- Returns:
- closest zone found
-
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
-
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, SortedSet<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 SortedSet<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
-
transferZoneGeometryToOsmEntityType
public static de.topobyte.osm4j.core.model.iface.EntityType transferZoneGeometryToOsmEntityType(org.locationtech.jts.geom.Geometry transferZoneGeometry)
Extract the OSM entity type from a PLANit Transfer zone- Parameters:
transferZoneGeometry
- to identify entity type for- Returns:
- the entity type
-
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
-
-