Class OsmPublicTransportReaderSettings

  • All Implemented Interfaces:
    ConverterReaderSettings

    public class OsmPublicTransportReaderSettings
    extends OsmReaderSettings
    Capture all the user configurable settings regarding how to parse (if at all) (public transport) transfer infrastructure such as stations, poles, platforms, and other stop and tranfer related infrastructure
    Author:
    markr
    • Field Detail

      • DEFAULT_TRANSFER_PARSER_ACTIVE

        public static boolean DEFAULT_TRANSFER_PARSER_ACTIVE
        by default the transfer parser is deactivated
      • DEFAULT_REMOVE_DANGLING_ZONES

        public static boolean DEFAULT_REMOVE_DANGLING_ZONES
        by default we are removing dangling zones
      • DEFAULT_REMOVE_DANGLING_TRANSFER_ZONE_GROUPS

        public static boolean DEFAULT_REMOVE_DANGLING_TRANSFER_ZONE_GROUPS
        by default we are removing dangling transfer zone groups
      • DEFAULT_SEARCH_RADIUS_PLATFORM2STOP_M

        public static double DEFAULT_SEARCH_RADIUS_PLATFORM2STOP_M
        default search radius in meters for mapping stops/platforms to stop positions on the networks when they have no explicit reference
      • DEFAULT_SEARCH_RADIUS_STATION2PLATFORM_M

        public static double DEFAULT_SEARCH_RADIUS_STATION2PLATFORM_M
        default search radius in meters for mapping stations to platforms on the networks when they have no explicit reference
      • DEFAULT_SEARCH_RADIUS_STATION_PARALLEL_TRACKS_M

        public static double DEFAULT_SEARCH_RADIUS_STATION_PARALLEL_TRACKS_M
        Default search radius in meters when trying to find parallel lines (tracks) for stand-alone stations
      • DEFAULT_CLOSEST_EDGE_SEARCH_BUFFER_DISTANCE_M

        public static double DEFAULT_CLOSEST_EDGE_SEARCH_BUFFER_DISTANCE_M
        The default buffer distance when looking for edges within a distance of the closest edge to create connectoids (stop_locations) on for transfer zones. In case candidates are so close just selecting the closest can lead to problems. By identifying multiple candidates via this buffer, we can then use more sophisticated ways than proximity to determine the best candidate
    • Constructor Detail

      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings()
        Constructor using default (Global) locale
      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings​(String countryName)
        Constructor with user defined source locale
        Parameters:
        countryName - to base source locale on
      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings​(URL inputSource,
                                                String countryName)
        Constructor with user defined source locale
        Parameters:
        inputSource - to extract OSM pt information from
        countryName - to base source locale on
      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings​(String countryName,
                                                PlanitOsmNetwork referenceNetwork)
        Constructor with user defined source locale
        Parameters:
        countryName - to base source locale on
        referenceNetwork - to use
      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings​(URL inputSource,
                                                String countryName,
                                                PlanitOsmNetwork referenceNetwork)
        Constructor with user defined source locale
        Parameters:
        inputSource - to use
        countryName - to base source locale on
        referenceNetwork - to use
      • OsmPublicTransportReaderSettings

        public OsmPublicTransportReaderSettings​(URL inputSource,
                                                String countryName,
                                                PlanitOsmNetwork referenceNetwork,
                                                OsmNetworkToZoningReaderData network2ZoningData)
        Constructor with user defined source locale
        Parameters:
        inputSource - to use
        countryName - to base source locale on
        referenceNetwork - to use
        network2ZoningData - to use
    • Method Detail

      • reset

        public void reset()
        be able to reset all settings if needed
      • setReferenceNetwork

        public void setReferenceNetwork​(PlanitOsmNetwork referenceNetwork)
        set the reference network to use
        Parameters:
        referenceNetwork - to use
      • getReferenceNetwork

        public PlanitOsmNetwork getReferenceNetwork()
        Get the reference network to use
        Returns:
        referenceNetwork
      • setNetworkDataForZoningReader

        public void setNetworkDataForZoningReader​(OsmNetworkToZoningReaderData network2ZoningData)
        allow one to set the network data required for parsing osm zoning data on the zoning reader
        Parameters:
        network2ZoningData - to use based on network reader that parsed the used reference network
      • getNetworkDataForZoningReader

        public OsmNetworkToZoningReaderData getNetworkDataForZoningReader()
        collect the network data required for parsing osm zoning data on the zoning reader
        Returns:
        network2ZoningData based on network reader that parsed the used reference network
      • activateParser

        public void activateParser​(boolean activate)
        set the flag whether or not the public transport infrastructure should be parsed or not
        Parameters:
        activate - when true activate, when false do not
      • isParserActive

        public boolean isParserActive()
        verifies if the parser for these settings is active or not
        Returns:
        true if active false otherwise
      • setStopToWaitingAreaSearchRadiusMeters

        public void setStopToWaitingAreaSearchRadiusMeters​(Number searchRadiusInMeters)
        Set the maximum search radius used when trying to map stops/platforms to stop positions on the networks, when no explicit relation is made known by OSM
        Parameters:
        searchRadiusInMeters - to use
      • getStopToWaitingAreaSearchRadiusMeters

        public double getStopToWaitingAreaSearchRadiusMeters()
        Collect the maximum search radius set when trying to map stops/platforms to stop positions on the networks, when no explicit relation is made known by OSM
        Returns:
        search radius in meters
      • setStationToWaitingAreaSearchRadiusMeters

        public void setStationToWaitingAreaSearchRadiusMeters​(Number searchRadiusInMeters)
        Set the maximum search radius used when trying to map stations to platforms on the networks, when no explicit relation is made known by OSM
        Parameters:
        searchRadiusInMeters - to use
      • getStationToWaitingAreaSearchRadiusMeters

        public double getStationToWaitingAreaSearchRadiusMeters()
        Collect the maximum search radius set when trying to map stations to platforms on the networks, when no explicit relation is made known by OSM
        Returns:
        search radius in meters
      • setStationToParallelTracksSearchRadiusMeters

        public void setStationToParallelTracksSearchRadiusMeters​(Number searchRadiusInMeters)
        Set the maximum search radius used when trying to find parallel lines (tracks) for stand-alone stations
        Parameters:
        searchRadiusInMeters - to use
      • getStationToParallelTracksSearchRadiusMeters

        public double getStationToParallelTracksSearchRadiusMeters()
        Collect the maximum search radius set when trying to find parallel lines (tracks) for stand-alone stations
        Returns:
        search radius in meters
      • excludeOsmNodesById

        public void excludeOsmNodesById​(Number... osmIds)
        Provide OSM ids of nodes that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a stop_position, station, platform, etc. tagged as a node
        Parameters:
        osmIds - to exclude (int or long)
      • excludeOsmNodesById

        public void excludeOsmNodesById​(Collection<Number> osmIds)
        Provide OSM ids of nodes that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a stop_position, station, platform, etc. tagged as a node
        Parameters:
        osmIds - to exclude (int or long)
      • excludeOsmNodeById

        public void excludeOsmNodeById​(Number osmId)
        Provide OSM id of node that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a stop_position, station, platform, etc. tagged as a node
        Parameters:
        osmId - to exclude (int or long)
      • excludeOsmWaysById

        public void excludeOsmWaysById​(Number... osmIds)
        Provide OSM ids of ways that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a station, platform, etc. tagged as a way (line, or polygon)
        Parameters:
        osmIds - to exclude (int or long)
      • excludeOsmWaysById

        public void excludeOsmWaysById​(Collection<Number> osmIds)
        Provide OSM ids of ways that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a station, platform, etc. tagged as a way (line or polygon)
        Parameters:
        osmIds - to exclude (int or long)
      • excludeOsmWayById

        public void excludeOsmWayById​(Number osmId)
        Provide OSM id of way that we are not to parse as public transport infrastructure, for example when we know the original coding or tagging is problematic for a station, platform, etc. tagged as a way (line or polygon)
        Parameters:
        osmId - to exclude
      • isExcludedOsmNode

        public boolean isExcludedOsmNode​(Number osmId)
        Verify if osm id is an excluded node for pt infrastructure parsing
        Parameters:
        osmId - to verify (int or long)
        Returns:
        true when excluded false otherwise
      • isExcludedOsmWay

        public boolean isExcludedOsmWay​(Number osmId)
        Verify if osm id is an excluded node for pt infrastructure parsing
        Parameters:
        osmId - to verify (int or long)
        Returns:
        true when excluded false otherwise
      • overwriteStopLocationWaitingArea

        public void overwriteStopLocationWaitingArea​(Number stopLocationOsmNodeId,
                                                     de.topobyte.osm4j.core.model.iface.EntityType waitingAreaEntityType,
                                                     Number waitingAreaOsmId)
        Provide explicit mapping for stop_locations (by osm node id) to the waiting area, e.g., platform, pole, station, halt, stop, etc. (by entity type and osm id). This overrides the parser's mapping functionality and immediately maps the stop location to this osm entity. Can be useful to avoid warnings or wrong mapping of stop locations in case of tagging errors.
        Parameters:
        stopLocationOsmNodeId - osm node id of stop location (int or long)
        waitingAreaEntityType - entity type of waiting area to map to
        waitingAreaOsmId - osm id of waiting area (platform, pole, etc.) (int or long)
      • isOverwriteStopLocationWaitingArea

        public boolean isOverwriteStopLocationWaitingArea​(Number stopLocationOsmNodeId)
        Verify if stop location's osm id is marked for overwritten platform mapping
        Parameters:
        stopLocationOsmNodeId - to verify (int or long)
        Returns:
        true when present, false otherwise
      • getOverwrittenStopLocationWaitingArea

        public Pair<de.topobyte.osm4j.core.model.iface.EntityType,​Long> getOverwrittenStopLocationWaitingArea​(Number stopLocationOsmNodeId)
        Verify if stop location's osm id is marked for overwritten platform mapping
        Parameters:
        stopLocationOsmNodeId - to verify (int or long)
        Returns:
        pair reflecting the entity type and waiting area osm id, null if not present
      • isWaitingAreaStopLocationOverwritten

        public boolean isWaitingAreaStopLocationOverwritten​(de.topobyte.osm4j.core.model.iface.EntityType waitingAreaType,
                                                            Number osmWaitingAreaId)
        Verify if the witing area is used as the designated waiting area for a stop location by means of a user explicitly stating it as such
        Parameters:
        waitingAreaType - of the waiting area
        osmWaitingAreaId - to use (int or long)
        Returns:
        true when waiting area is defined for a stop location as designated waiting area, false otherwise
      • overwriteWaitingAreaNominatedOsmWayForStopLocation

        public void overwriteWaitingAreaNominatedOsmWayForStopLocation​(Number waitingAreaOsmId,
                                                                       de.topobyte.osm4j.core.model.iface.EntityType waitingAreaEntityType,
                                                                       Number OsmWayId)
        Provide explicit mapping for waiting areas (platform, bus_stop, pole, station) to a nominated osm way (by osm id). This overrides the parser's mapping functionality and forces the parser to create a stop location on the nominated osm way. Only use in case the platform has no stop_location and no stop_location maps to this waiting area. One cannot use this method and also use this waiting area in overriding stop_location mappings.
        Parameters:
        waitingAreaOsmId - osm node id of stop location (int or long)
        waitingAreaEntityType - entity type of waiting area to map to
        OsmWayId - osm id of waiting area (platform, pole, etc.) (int or long)
      • hasWaitingAreaNominatedOsmWayForStopLocation

        public boolean hasWaitingAreaNominatedOsmWayForStopLocation​(Number waitingAreaOsmId,
                                                                    de.topobyte.osm4j.core.model.iface.EntityType waitingAreaEntityType)
        Verify if waiting area's osm id is marked for overwritten osm way mapping
        Parameters:
        waitingAreaOsmId - to verify (int or long)
        waitingAreaEntityType - type of waiting area
        Returns:
        true when present, false otherwise
      • getWaitingAreaNominatedOsmWayForStopLocation

        public Long getWaitingAreaNominatedOsmWayForStopLocation​(Number waitingAreaOsmId,
                                                                 de.topobyte.osm4j.core.model.iface.EntityType waitingAreaEntityType)
        collect waiting area's osm way id to use for identifying most logical stop_location (connectoid)
        Parameters:
        waitingAreaOsmId - to collect (int or long)
        waitingAreaEntityType - type of waiting area
        Returns:
        osm way id, null if not available
      • setRemoveDanglingZones

        public void setRemoveDanglingZones​(boolean removeDanglingZones)
        indicate whether to remove dangling zones or not
        Parameters:
        removeDanglingZones - yes or no
      • isRemoveDanglingZones

        public boolean isRemoveDanglingZones()
        verify if dangling zones are removed from the final zoning
        Returns:
        true when we are removing them, false otherwise
      • setRemoveDanglingTransferZoneGroups

        public void setRemoveDanglingTransferZoneGroups​(boolean removeDanglingTransferZoneGroups)
        indicate whether to remove dangling transfer zone groups or not
        Parameters:
        removeDanglingTransferZoneGroups - yes or no
      • isRemoveDanglingTransferZoneGroups

        public boolean isRemoveDanglingTransferZoneGroups()
        verify if dangling transfer zone groups are removed from the final zoning
        Returns:
        true when we are removing them, false otherwise