.overwrite_gtfs_stop_to_link_mapping(+)

GtfsZoningReaderSettings method

Description

Use this method to force override the mapping from a GTFS stop’s preferred network link (the link where the transit vehicle is approaching from to service the GTFS stop) to a user defined link.

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.

PLANit links (road/rail) have multiple ids, the user has the freedom to choose to which of these ids to map against. PLANit stored links in its own data format with an id referred to as the XML_ID, but if the transfer zone was sourced from an external source such as Open Street Map then the original id of that data source is captured as well via its EXTERNAL_ID. Both are valid ids to use for the mapping of this method, but they require the user to indicate which one to use.

Signature

.overwrite_gtfs_stop_to_link_mapping(gtfs_stop_id: str, planit_link_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
planit_link_id str or int N/A N/A The link id this overwrite relates to
id_mapper_type IdMapperType N/A N/A The type of id provided in planit_link_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.overwrite_gtfs_stop_to_link_mapping(
            "gtfs_Stop_id_1", "osm_way_id", IdMapperType.EXTERNAL)
gtfs_reader.settings.zoning_settings.overwrite_gtfs_stop_to_link_mapping(
            "gtfs_Stop_id_2", "planit_link_xml_id", IdMapperType.XML)            

See also

N/A

Source code

Class GtfsZoningReaderSettingsWrapper in converterwrappers.py