Class GtfsZoningReaderSettings
- java.lang.Object
-
- org.goplanit.gtfs.converter.GtfsConverterReaderSettingsImpl
-
- org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
-
- org.goplanit.gtfs.converter.zoning.GtfsZoningReaderSettings
-
- All Implemented Interfaces:
ConverterReaderSettings
,GtfsConverterReaderSettings
public class GtfsZoningReaderSettings extends GtfsConverterReaderSettingsWithModeMapping implements GtfsConverterReaderSettings
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 captured from raw (static) GTFS feeds- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description static double
DEFAULT_CLOSEST_LINK_SEARCH_BUFFER_DISTANCE_M
The default buffer distance when looking for links within a distance of the closest link to a GTFS stop to create connectoids (stop_locations).static double
DEFAULT_GTFSSTOP_LINK_SEARCH_METERS
default search radius for mapping GTFS stops to PLANit links for determining stop locations on road/rail/waterstatic double
DEFAULT_GTFSSTOP_TRANSFERZONE_SEARCH_METERS
default search radius for mapping GTFS stops to PLANit transfer zonesstatic boolean
DEFAULT_LOG_CREATED_GTFS_ZONES
default setting for logging the creation of new transfer zones based and GTFS stopsstatic boolean
DEFAULT_LOG_MAPPED_GTFS_ZONES
default setting for logging mappings between GTFS zones and existing PLANit transfer zonesstatic boolean
DEFAULT_REMOVE_UNUSED_TRANSFER_ZONES
default flag setting whether to remove unused transfer zones after GTFS parsing is complete-
Fields inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
activatedGtfsModes, defaultGtfsMode2PrefinedModeTypeMap, routeTypeChoice
-
-
Constructor Summary
Constructors Constructor Description GtfsZoningReaderSettings(GtfsConverterReaderSettingsWithModeMapping settings)
Copy constructor creating a shallow copy of the underlying mode mapping so it is synced with the provided settings.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateExtendedLoggingForGtfsZones(String... gtfsStopIds)
Allow user to trigger extensive logging on how particular GTFS stops are being parsed and converted into a PLANit transfer zonevoid
activateExtendedLoggingForGtfsZones(List<String> gtfsStopIds)
Allow user to trigger extensive logging on how particular GTFS stops are being parsed and converted into a PLANit transfer zonevoid
addLogGtfsStopToLinkMapping(String... gtfsStopIds)
Log the chosen PLANit link (and its ids) to the user for the given GTFS stop, so it can be manually verified what the algorithm has chosen from the logsvoid
addLogGtfsStopToLinkMapping(List<String> gtfsStopIds)
Log the chosen PLANit link (and its ids) to the user for the given GTFS stop, so it can be manually verified what the algorithm has chosen from the logsvoid
addOverwriteGtfsStopTransferZoneMapping(String gtfsStopId, Object transferZoneId, IdMapperType idType)
Provide explicit mapping for GTFS stop id to an existing PLANit transfer zone, e.g., platform, pole, station, halt, stop, etc.void
disallowGtfsStopToTransferZoneJointMapping(String... gtfsStopIds)
Flag that given GTFS stop may not be mapped to a transfer zone together with any other (nearby) GTFS stop.void
disallowGtfsStopToTransferZoneJointMapping(List<String> gtfsStopIds)
Flag that given GTFS stop may not be mapped to a transfer zone together with any other (nearby) GTFS stop.void
excludeGtfsStopById(String gtfsStopId)
Provide id of GTFS stop that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our outputvoid
excludeGtfsStopsById(String... gtfsStopIds)
Provide GTFS stop ids that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our outputvoid
excludeGtfsStopsById(Collection<String> osmIds)
Provide OSM ids of nodes that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our outputvoid
forceCreateNewTransferZoneForGtfsStops(String... gtfsStopIds)
Flag that given GTFS stop must trigger creation of a new transfer zone, so do not attempt to map it to any existing transfer zones.void
forceCreateNewTransferZoneForGtfsStops(List<String> gtfsStopIds)
Flag that given GTFS stop must trigger creation of a new transfer zone, so do not attempt to map it to any existing transfer zones.double
getGtfsStopToLinkSearchRadiusMeters()
Search radius in meters to map a GTFS stop location to an existing PLANit link (for its stop location)double
getGtfsStopToTransferZoneSearchRadiusMeters()
Search radius in meters to map a GTFS stop location to an existing PLANit transfer zoneorg.locationtech.jts.geom.Coordinate
getOverwrittenGtfsStopLocation(String gtfsStopId)
get explicitly mapped location for given GTFS stop id (if any))Pair<Object,IdMapperType>
getOverwrittenGtfsStopToLinkMapping(String gtfsStopId)
Collect overwritten link id information for GTFS stop id (if present)Collection<Pair<Object,IdMapperType>>
getOverwrittenGtfsStopTransferZoneMapping(String gtfsStopId)
get explicitly mapped transfer zone(s') external id for given GTFS stop id (if any))Function<ServiceNode,String>
getServiceNodeToGtfsStopIdFunction()
Provide the mapping from a PLANit service node in the service network to its GTFS STOP IDboolean
hasOverwrittenGtfsStopToLinkMapping(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mappingboolean
isDisallowGtfsStopToTransferZoneJointMapping(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mappingboolean
isExcludedGtfsStop(String gtfsStopId)
Verify if GTFS stop is marked for exclusion during parsingboolean
isExtendedLoggingForGtfsZoneActivated(String gtfsStopId)
Check if extensive logging on how particular GTFS stop is being parsed is activatedboolean
isForceCreateNewTransferZoneForGtfsStop(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mappingboolean
isLogCreatedGtfsZones()
boolean
isLogGtfsStopToLinkMapping(String gtfsStopId)
Verify if GTFS stop id is marked for logging the link mappingboolean
isLogMappedGtfsZones()
boolean
isOverwrittenGtfsStopLocation(String gtfsStopId)
Verify if stop id is marked for overwritten locationboolean
isOverwrittenGtfsStopTransferZoneMapping(String gtfsStopId)
Verify if stop id is marked for overwritten transfer zone mappingboolean
isRemoveUnusedTransferZones()
void
logSettings()
Log settings usedvoid
overwriteGtfsStopToLinkMapping(String gtfsStopId, Object linkId, IdMapperType idMapperType)
Provide explicit mapping for GtfsStop id (platform, bus_stop, pole, station) to a link by one of its id's This forces the parser to use the nominated link as the access link for the GTFS stop.void
reset()
be able to reset all settings if neededvoid
setGtfsStopToLinkSearchRadiusMeters(Number searchRadiusMeters)
Search radius in meters to map a GTFS stop location to an existing PLANit link (for its stop location)void
setGtfsStopToTransferZoneSearchRadiusMeters(Number searchRadiusMeters)
Search radius in meters to map a GTFS stop location to an existing PLANit transfer zonevoid
setLogCreatedGtfsZones(boolean logCreatedGtfsZones)
void
setLogMappedGtfsZones(boolean logMappedGtfsZones)
void
setOverwriteGtfsStopLocation(String gtfsStopId, double latitude, double longitude)
Provide explicit mapping for GTFS stop id to an alternative location.void
setRemoveUnusedTransferZones(boolean removeUnusedTransferZones)
-
Methods inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsWithModeMapping
activateGtfsRouteTypeMode, deactivateAllModesExcept, deactivateGtfsMode, deactivateGtfsModes, findGtfsModesFor, getAcivatedGtfsModes, getAcivatedGtfsModes, getAcivatedPlanitPredefinedModes, getAcivatedPlanitPredefinedModes, getRouteTypeChoice, initialiseDefaultModeMappings, isGtfsModeActivated, setDefaultGtfs2PredefinedModeTypeMapping, setDefaultGtfs2PredefinedModeTypeMapping
-
Methods inherited from class org.goplanit.gtfs.converter.GtfsConverterReaderSettingsImpl
getCountryName, getInputSource, setInputFile, setInputSource
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.goplanit.gtfs.converter.GtfsConverterReaderSettings
getCountryName, getInputSource
-
-
-
-
Field Detail
-
DEFAULT_REMOVE_UNUSED_TRANSFER_ZONES
public static final boolean DEFAULT_REMOVE_UNUSED_TRANSFER_ZONES
default flag setting whether to remove unused transfer zones after GTFS parsing is complete- See Also:
- Constant Field Values
-
DEFAULT_GTFSSTOP_TRANSFERZONE_SEARCH_METERS
public static final double DEFAULT_GTFSSTOP_TRANSFERZONE_SEARCH_METERS
default search radius for mapping GTFS stops to PLANit transfer zones- See Also:
- Constant Field Values
-
DEFAULT_GTFSSTOP_LINK_SEARCH_METERS
public static final double DEFAULT_GTFSSTOP_LINK_SEARCH_METERS
default search radius for mapping GTFS stops to PLANit links for determining stop locations on road/rail/water- See Also:
- Constant Field Values
-
DEFAULT_LOG_MAPPED_GTFS_ZONES
public static final boolean DEFAULT_LOG_MAPPED_GTFS_ZONES
default setting for logging mappings between GTFS zones and existing PLANit transfer zones- See Also:
- Constant Field Values
-
DEFAULT_LOG_CREATED_GTFS_ZONES
public static final boolean DEFAULT_LOG_CREATED_GTFS_ZONES
default setting for logging the creation of new transfer zones based and GTFS stops- See Also:
- Constant Field Values
-
DEFAULT_CLOSEST_LINK_SEARCH_BUFFER_DISTANCE_M
public static double DEFAULT_CLOSEST_LINK_SEARCH_BUFFER_DISTANCE_M
The default buffer distance when looking for links within a distance of the closest link to a GTFS stop to create connectoids (stop_locations). 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
-
GtfsZoningReaderSettings
public GtfsZoningReaderSettings(GtfsConverterReaderSettingsWithModeMapping settings)
Copy constructor creating a shallow copy of the underlying mode mapping so it is synced with the provided settings. Useful when both settings are used in conjunction and we want to avoid having to sync information- Parameters:
settings
- to obtain mode mapping information from
-
-
Method Detail
-
getGtfsStopToTransferZoneSearchRadiusMeters
public double getGtfsStopToTransferZoneSearchRadiusMeters()
Search radius in meters to map a GTFS stop location to an existing PLANit transfer zone- Returns:
- searchRadiusMeters being applied
-
setGtfsStopToTransferZoneSearchRadiusMeters
public void setGtfsStopToTransferZoneSearchRadiusMeters(Number searchRadiusMeters)
Search radius in meters to map a GTFS stop location to an existing PLANit transfer zone- Parameters:
searchRadiusMeters
- to apply
-
getGtfsStopToLinkSearchRadiusMeters
public double getGtfsStopToLinkSearchRadiusMeters()
Search radius in meters to map a GTFS stop location to an existing PLANit link (for its stop location)- Returns:
- searchRadiusMeters being applied
-
setGtfsStopToLinkSearchRadiusMeters
public void setGtfsStopToLinkSearchRadiusMeters(Number searchRadiusMeters)
Search radius in meters to map a GTFS stop location to an existing PLANit link (for its stop location)- Parameters:
searchRadiusMeters
- to apply
-
getServiceNodeToGtfsStopIdFunction
public Function<ServiceNode,String> getServiceNodeToGtfsStopIdFunction()
Provide the mapping from a PLANit service node in the service network to its GTFS STOP ID- Returns:
- function mapping to perform conversion from a given service node to GTFS STOP ID
-
addOverwriteGtfsStopTransferZoneMapping
public void addOverwriteGtfsStopTransferZoneMapping(String gtfsStopId, Object transferZoneId, IdMapperType idType)
Provide explicit mapping for GTFS stop id to an existing PLANit transfer zone, e.g., platform, pole, station, halt, stop, etc. (by its external id, e.g. OSM id) This overrides the parser's mapping functionality and immediately maps the stop to this entity. Can be useful to avoid warnings or wrong mapping of stop locations in case the automated behaviour does not perform as expected.It also allows one to map a GTFS stop to multiple transfer zones in case the GTFS information is more aggregate than the transfer zones, e.g., if the underlying OSM data has resulted in separate platforms, but the GTFS stop reflects all platforms at once
- Parameters:
gtfsStopId
- id of stop locationtransferZoneId
- Id of waiting area (platform, pole, etc.) (int or long)idType
- which id of the transfer zone (XML which is in the persisted PLANit file, or external (likely for example the original OSM id)
-
isOverwrittenGtfsStopTransferZoneMapping
public boolean isOverwrittenGtfsStopTransferZoneMapping(String gtfsStopId)
Verify if stop id is marked for overwritten transfer zone mapping- Parameters:
gtfsStopId
- to verify- Returns:
- true when present, false otherwise
-
getOverwrittenGtfsStopTransferZoneMapping
public Collection<Pair<Object,IdMapperType>> getOverwrittenGtfsStopTransferZoneMapping(String gtfsStopId)
get explicitly mapped transfer zone(s') external id for given GTFS stop id (if any))- Parameters:
gtfsStopId
- to collect for- Returns:
- mapped transfer zone id(s) and the type(s) (null if none is mapped)
-
setOverwriteGtfsStopLocation
public void setOverwriteGtfsStopLocation(String gtfsStopId, double latitude, double longitude)
Provide explicit mapping for GTFS stop id to an alternative location. USeful in case the original location is slightly off compared to underlying network making finding an automated mapping to the network problematic. Often, moving the location slghty further away from the road will solve this problem.- Parameters:
gtfsStopId
- id of stop locationlatitude
- new latitudelongitude
- new longitude
-
isOverwrittenGtfsStopLocation
public boolean isOverwrittenGtfsStopLocation(String gtfsStopId)
Verify if stop id is marked for overwritten location- Parameters:
gtfsStopId
- to verify- Returns:
- true when present, false otherwise
-
getOverwrittenGtfsStopLocation
public org.locationtech.jts.geom.Coordinate getOverwrittenGtfsStopLocation(String gtfsStopId)
get explicitly mapped location for given GTFS stop id (if any))- Parameters:
gtfsStopId
- to collect for- Returns:
- mapped transfer zone (null if none is mapped)
-
isLogMappedGtfsZones
public boolean isLogMappedGtfsZones()
- Returns:
- true when mapped GTFS stops logged, false otherwise
-
isExtendedLoggingForGtfsZoneActivated
public boolean isExtendedLoggingForGtfsZoneActivated(String gtfsStopId)
Check if extensive logging on how particular GTFS stop is being parsed is activated- Parameters:
gtfsStopId
- to verify- Returns:
- boolean indication if extended logging is activated or not
-
setLogMappedGtfsZones
public void setLogMappedGtfsZones(boolean logMappedGtfsZones)
- Parameters:
logMappedGtfsZones
- when true mapped GTFS stops are logged, otherwise not
-
activateExtendedLoggingForGtfsZones
public void activateExtendedLoggingForGtfsZones(String... gtfsStopIds)
Allow user to trigger extensive logging on how particular GTFS stops are being parsed and converted into a PLANit transfer zone- Parameters:
gtfsStopIds
- to activate extended logging for
-
activateExtendedLoggingForGtfsZones
public void activateExtendedLoggingForGtfsZones(List<String> gtfsStopIds)
Allow user to trigger extensive logging on how particular GTFS stops are being parsed and converted into a PLANit transfer zone- Parameters:
gtfsStopIds
- to activate extended logging for
-
isLogCreatedGtfsZones
public boolean isLogCreatedGtfsZones()
- Returns:
- true when newly created transfer zones based on GTFS stops logged, false otherwise
-
setLogCreatedGtfsZones
public void setLogCreatedGtfsZones(boolean logCreatedGtfsZones)
- Parameters:
logCreatedGtfsZones
- when true, each newly created (unmapped) transfer zones based on GTFS stops are logged, otherwise not
-
isRemoveUnusedTransferZones
public boolean isRemoveUnusedTransferZones()
- Returns:
- true when removing unused transfer zones, false otherwise
-
setRemoveUnusedTransferZones
public void setRemoveUnusedTransferZones(boolean removeUnusedTransferZones)
- Parameters:
removeUnusedTransferZones
- when true, remove unused transfer zones, otherwise do not
-
logSettings
public void logSettings()
Log settings used- Specified by:
logSettings
in interfaceConverterReaderSettings
- Specified by:
logSettings
in interfaceGtfsConverterReaderSettings
- Overrides:
logSettings
in classGtfsConverterReaderSettingsWithModeMapping
-
reset
public void reset()
be able to reset all settings if needed- Specified by:
reset
in interfaceConverterReaderSettings
- Overrides:
reset
in classGtfsConverterReaderSettingsWithModeMapping
-
excludeGtfsStopsById
public void excludeGtfsStopsById(String... gtfsStopIds)
Provide GTFS stop ids that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our output- Parameters:
gtfsStopIds
- to exclude (int or long)
-
excludeGtfsStopsById
public void excludeGtfsStopsById(Collection<String> osmIds)
Provide OSM ids of nodes that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our output- Parameters:
osmIds
- to exclude (int or long)
-
excludeGtfsStopById
public void excludeGtfsStopById(String gtfsStopId)
Provide id of GTFS stop that we are not to parse as public transport infrastructure, for example when we know the stop is problematic and we want to avoid any warnings in our output- Parameters:
gtfsStopId
- to exclude
-
isExcludedGtfsStop
public boolean isExcludedGtfsStop(String gtfsStopId)
Verify if GTFS stop is marked for exclusion during parsing- Parameters:
gtfsStopId
- to verify- Returns:
- true when excluded false otherwise
-
overwriteGtfsStopToLinkMapping
public void overwriteGtfsStopToLinkMapping(String gtfsStopId, Object linkId, IdMapperType idMapperType)
Provide explicit mapping for GtfsStop id (platform, bus_stop, pole, station) to a link by one of its id's This forces the parser to use the nominated link as the access link for the GTFS stop.This is only considered for GTFS stops that could not be matched to existing transfer zones already present in the network since it is assumed existing transfer zones have a correct mapping to the network already
- Parameters:
gtfsStopId
- GTFS stop id to provide link mapping forlinkId
- link id to map toidMapperType
- which id of the link to use
-
hasOverwrittenGtfsStopToLinkMapping
public boolean hasOverwrittenGtfsStopToLinkMapping(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mapping- Parameters:
gtfsStopId
- GTFS stop id to verify- Returns:
- true when present, false otherwise
-
getOverwrittenGtfsStopToLinkMapping
public Pair<Object,IdMapperType> getOverwrittenGtfsStopToLinkMapping(String gtfsStopId)
Collect overwritten link id information for GTFS stop id (if present)- Parameters:
gtfsStopId
- GTFS stop id to get mapping for- Returns:
- true when present, false otherwise
-
addLogGtfsStopToLinkMapping
public void addLogGtfsStopToLinkMapping(String... gtfsStopIds)
Log the chosen PLANit link (and its ids) to the user for the given GTFS stop, so it can be manually verified what the algorithm has chosen from the logs- Parameters:
gtfsStopIds
- to log mapping for
-
addLogGtfsStopToLinkMapping
public void addLogGtfsStopToLinkMapping(List<String> gtfsStopIds)
Log the chosen PLANit link (and its ids) to the user for the given GTFS stop, so it can be manually verified what the algorithm has chosen from the logs- Parameters:
gtfsStopIds
- to log mapping for
-
isLogGtfsStopToLinkMapping
public boolean isLogGtfsStopToLinkMapping(String gtfsStopId)
Verify if GTFS stop id is marked for logging the link mapping- Parameters:
gtfsStopId
- GTFS stop id to verify- Returns:
- true when present, false otherwise
-
disallowGtfsStopToTransferZoneJointMapping
public void disallowGtfsStopToTransferZoneJointMapping(String... gtfsStopIds)
Flag that given GTFS stop may not be mapped to a transfer zone together with any other (nearby) GTFS stop. If such a situation is identified, a new transfer zone is created instead- Parameters:
gtfsStopIds
- GTFS stop id to provide link mapping for
-
disallowGtfsStopToTransferZoneJointMapping
public void disallowGtfsStopToTransferZoneJointMapping(List<String> gtfsStopIds)
Flag that given GTFS stop may not be mapped to a transfer zone together with any other (nearby) GTFS stop. If such a situation is identified, a new transfer zone is created instead- Parameters:
gtfsStopIds
- GTFS stop id to provide link mapping for
-
isDisallowGtfsStopToTransferZoneJointMapping
public boolean isDisallowGtfsStopToTransferZoneJointMapping(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mapping- Parameters:
gtfsStopId
- GTFS stop id to verify- Returns:
- true when present, false otherwise
-
forceCreateNewTransferZoneForGtfsStops
public void forceCreateNewTransferZoneForGtfsStops(String... gtfsStopIds)
Flag that given GTFS stop must trigger creation of a new transfer zone, so do not attempt to map it to any existing transfer zones.- Parameters:
gtfsStopIds
- GTFS stop id to provide link mapping for
-
forceCreateNewTransferZoneForGtfsStops
public void forceCreateNewTransferZoneForGtfsStops(List<String> gtfsStopIds)
Flag that given GTFS stop must trigger creation of a new transfer zone, so do not attempt to map it to any existing transfer zones.- Parameters:
gtfsStopIds
- GTFS stop id to provide link mapping for
-
isForceCreateNewTransferZoneForGtfsStop
public boolean isForceCreateNewTransferZoneForGtfsStop(String gtfsStopId)
Verify if GTFS stop id is marked for overwritten link mapping- Parameters:
gtfsStopId
- GTFS stop id to verify- Returns:
- true when present, false otherwise
-
-