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 transfer related infrastructure
    Author:
    markr
    • Field Detail

      • overwriteWaitingAreaModeAccess

        protected final Map<de.topobyte.osm4j.core.model.iface.EntityType,​Map<Long,​SortedSet<String>>> overwriteWaitingAreaModeAccess
        track overwritten mode access values for specific OSM waiting areas. Can be used in case the OSM file is incorrectly tagged which causes problems in the memory model. Here one can be manually overwrite the allowable modes for this particular waiting area.
      • DEFAULT_TRANSFER_PARSER_ACTIVE

        public static boolean DEFAULT_TRANSFER_PARSER_ACTIVE
        by default the transfer parser is activated
      • 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 multiple candidates are close just selecting the closest can lead to problems.This is only used as a way to exclude clearly inadequate options.
      • DEFAULT_CONNECT_DANGLING_FERRY_STOP_TO_FERRY_ROUTE

        public static boolean DEFAULT_CONNECT_DANGLING_FERRY_STOP_TO_FERRY_ROUTE
        by default we connect dangling ferry stops to the nearest ferry route
      • DEFAULT_SEARCH_RADIUS_FERRY_STOP_TO_FERRY_ROUTE_M

        public static double DEFAULT_SEARCH_RADIUS_FERRY_STOP_TO_FERRY_ROUTE_M
        default search radius in meters for mapping ferry stops to ferry routes. When found and isConnectDanglingFerryStopToNearbyFerryRoute() is true then a new link to the nearest waterway running the ferry is created to avoid the ferry stop to be dangling
    • 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​(String inputSource,
                                                String countryName)
        /** Constructor with user defined source locale
        Parameters:
        inputSource - to use, expected local file location
        countryName - the full country name to use speed limit data for, see also the OsmSpeedLimitDefaultsByCountry class
      • 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
    • Method Detail

      • reset

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

        public void logSettings()
        Log relevant settings
      • activateParser

        public void activateParser​(boolean activate)
        set the flag whether 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
      • overwriteWaitingAreaOfStopLocation

        public void overwriteWaitingAreaOfStopLocation​(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)
      • isOverwriteWaitingAreaOfStopLocation

        public boolean isOverwriteWaitingAreaOfStopLocation​(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
      • getOverwrittenWaitingAreaOfStopLocation

        public Pair<de.topobyte.osm4j.core.model.iface.EntityType,​Long> getOverwrittenWaitingAreaOfStopLocation​(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
      • isWaitingAreaOfStopLocationOverwritten

        public boolean isWaitingAreaOfStopLocationOverwritten​(de.topobyte.osm4j.core.model.iface.EntityType waitingAreaType,
                                                              Number osmWaitingAreaId)
        Verify if the waiting 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
      • suppressOsmRelationStopAreaLogging

        public void suppressOsmRelationStopAreaLogging​(Number... osmStopAreaRelationIds)
        Suppress any logging for given stop area relation ids
        Parameters:
        osmStopAreaRelationIds - relation ids to suppress logging for
      • suppressOsmRelationStopAreaLogging

        public void suppressOsmRelationStopAreaLogging​(List<Number> osmStopAreaRelationIds)
        Suppress any logging for given stop area relation ids
        Parameters:
        osmStopAreaRelationIds - relation ids to suppress logging for
      • isSuppressOsmRelationStopAreaLogging

        public boolean isSuppressOsmRelationStopAreaLogging​(Number osmStopAreaRelationId)
        Check if stop area relation id logging is suppressed
        Parameters:
        osmStopAreaRelationId - to check
        Returns:
        true when suppressed, false otherwise
      • isConnectDanglingFerryStopToNearbyFerryRoute

        public boolean isConnectDanglingFerryStopToNearbyFerryRoute()
        Is flag for connecting dangling ferry stops to nearby ferry route set or not
        Returns:
        true when active, false otherwise
      • setConnectDanglingFerryStopToNearbyFerryRoute

        public void setConnectDanglingFerryStopToNearbyFerryRoute​(boolean connectDanglingFerryStopToNearbyFerryRoute)
        Decide whether to keep ferry stops (terminals) that are identified as dangling, i.e., do not reside on any exiting road or waterway and connect them to the nearest ferry route (within reason).
        Parameters:
        connectDanglingFerryStopToNearbyFerryRoute - when true do this, when false do not
      • getFerryStopToFerryRouteSearchRadiusMeters

        public double getFerryStopToFerryRouteSearchRadiusMeters()
      • setFerryStopToFerryRouteSearchRadiusMeters

        public void setFerryStopToFerryRouteSearchRadiusMeters​(Number searchRadiusFerryStopToFerryRouteMeters)
      • overwriteWaitingAreaModeAccess

        public void overwriteWaitingAreaModeAccess​(Number osmId,
                                                   de.topobyte.osm4j.core.model.iface.EntityType osmEntityType,
                                                   String... osmModes)
        Overwrite the mode access for a given waiting area
        Parameters:
        osmId - to overwrite for
        osmEntityType - to use
        osmModes - to set as eligible
      • isOverwriteWaitingAreaModeAccess

        public boolean isOverwriteWaitingAreaModeAccess​(Number osmId,
                                                        de.topobyte.osm4j.core.model.iface.EntityType osmEntityType)
        Verify if the mode access for a given waiting area is overwritten
        Parameters:
        osmId - to verify
        osmEntityType - to use
        Returns:
        true when present false otherwise
      • getOverwrittenWaitingAreaModeAccess

        public SortedSet<String> getOverwrittenWaitingAreaModeAccess​(Number osmId,
                                                                     de.topobyte.osm4j.core.model.iface.EntityType osmEntityType)
        Get the overwritten OSM modes for a given waiting area (if defined)
        Parameters:
        osmId - to collect for
        osmEntityType - of the OSM id
        Returns:
        overwritten OSM modes to apply, null if not present