.set_input_file(+)
GtfsIntermodalReaderSettings method
Description
Set the input file to parse by the GtfsIntermodalReader
. This is a mandatory setting the user is expected to set.
It is expected this is a zip file containing the various GTFS files outlined in the specification.
Make sure the input file is locally available and you have access rights to read the file from where the
GtfsIntermodalReader
is running.
Signature
.set_input_file(input_file: str)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
input_file |
String |
None |
N/A | The input file to extract GTFS public transport services from |
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)
# Network reader to use to impose GTFS on:
# Open Street Map (OSM) intermodal reader
osm_reader = intermodal_converter.create_reader(IntermodalReaderType.OSM, "Australia")
osm_reader.settings.set_input_file(SYDNEY_OSM_PBF_FILE_PATH)
# GTFS reader
gtfs_reader: GtfsIntermodalReaderWrapper = \
intermodal_converter.create_reader(IntermodalReaderType.GTFS, "Australia", osm_reader)
gtfs_reader.settings.set_input_file(SYDNEY_GTFS_FILE_PATH)
gtfs_reader.settings.services_settings.day_of_week = DayOfWeek.THURSDAY
gtfs_reader.settings.services_settings.add_time_period_filter(
datetime.time(hour=6, minute=0, second=0),
datetime.time(hour=9, minute=59, second=59)
)
# PLANit writer
planit_writer = intermodal_converter.create_writer(IntermodalWriterType.PLANIT)
planit_writer.settings.set_output_directory(OUTPUT_PATH)
planit_writer.settings.set_country("Australia")
# perform conversion (with services)
intermodal_converter.convert_with_services(gtfs_reader, planit_writer)
Source code
Class ReaderSettingsWrapper
in converterwrappers.py