.is_gtfs_route_included_by_short_name(+)

GtfsServicesReaderSettings method

Description

Verify if a particular GTFS route, by its GTFS shortname, a.k.a. head sign, is currently included in the parsing. This does not check if it present in the data, it merely verifies it has not been explicitly excluded, or if it has been explicitly included.

Signature

.is_gtfs_route_included_by_short_name(gtfs_short_name: str)

with

Parameter Type Unit Default Description
gtfs_short_name str None N/A GTFS route to verify

Return type

bool (True or False)

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>)

## test for route inlusion ##
gtfs_reader.settings.services_settings.exclude_all_gtfs_routes_except_by_short_name([`431`,`433`])
assert gtfs_reader.settings.services_settings.is_gtfs_route_included_by_short_name('431') is True
assert gtfs_reader.settings.services_settings.is_gtfs_route_included_by_short_name('999') is False

See also

N/A

Source code

Class GtfsServicesReaderSettingsWrapper in converterwrappers.py