Class PlanitTransferZoneUtils


  • public class PlanitTransferZoneUtils
    extends Object
    Static helper methods to support parsing/functionality of PLANit TransferZones
    Author:
    markr
    • Constructor Detail

      • PlanitTransferZoneUtils

        public PlanitTransferZoneUtils()
    • 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 for
        transferZoneGroups - to check against
        osmNodes - to extract geo information from if needed
        suppressLogging - when true suppress logging, false otherwise
        geoUtils - 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 verify
        location - 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 to
        tags - 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 use
        eligibleOsmModes - 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 - node
        tags - tags of the node
        Returns:
        transfer zone type, unknown if not able to map