.add_overwrite_gtfs_stop_transfer_zone_mapping(+)
Description
Use this method to force override the mapping from a GTFS stop to an existing PLANit transfer zone (this may be a stop for example parsed from Open Street Map).
This can be useful in case the automated mapping procedure falls short due to - for example - suboptimal alignment between the network and the GTFS dataset.
The PLANit transfer zones have multiple ids, the user has the freedom to choose to which of these ids to map against. PLANit generates and persist id’s via its own
XML_ID
, but if the if transfer zone was sourced from an external source such as Open Street Map then the original id of that data source is also captured via anEXTERNAL_ID
. Both are valid ids to use for the mapping of this method, but they require the user to indicate which one to use.
Note that we ‘add’ and not ‘set’ with this method. That is because the reader allows for mapping a GTFS stop to multiple transfer zones in case the GTFS information is more aggregate than the transfer zones. For example if the underlying network/zoning has resulted in separate platforms, but the GTFS stop reflects all platforms at once.
Signature
.add_overwrite_gtfs_stop_transfer_zone_mapping(gtfs_stop_id: str, transfer_zone_id: Union[int, str], id_mapper_type: IdMapperType)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
gtfs_stop_id |
str |
N/A | N/A | The GTFS stop id this overwrite relates to |
transfer_zone_id |
str or int |
N/A | N/A | The existing transfer zone id this overwrite relates to |
id_mapper_type |
IdMapperType |
N/A | N/A | The type of id provided in transfer_zone_id |
Return type
N/A
Example 1
from planit import *
# create an intermodal converter
planit_instance = Planit()
intermodal_converter = planit_instance.converter_factory.create(ConverterType.INTERMODAL)
from planit import *
# create an intermodal converter
planit_instance = Planit()
intermodal_converter = planit_instance.converter_factory.create(ConverterType.INTERMODAL)
# <some_intermodal_reader> = construct OSM or PLANit intermodal reader for example
# GTFS reader
gtfs_reader: GtfsIntermodalReaderWrapper = \
intermodal_converter.create_reader(IntermodalReaderType.GTFS, "Australia", <some_intermodal_reader>)
## override mapping explicitly ##
gtfs_reader.settings.zoning_settings.add_overwrite_gtfs_stop_transfer_zone_mapping(
"gtfs_Stop_id_1", "osm_platform_way_id", IdMapperType.EXTERNAL)
gtfs_reader.settings.zoning_settings.add_overwrite_gtfs_stop_transfer_zone_mapping(
"gtfs_Stop_id_2", "planit_transfer_zone_xml_id", IdMapperType.XML)
See also
N/A
Source code
Class GtfsZoningReaderSettingsWrapper
in converterwrappers.py