.convert(+)
IntermodalConverter method
The IntermodalConverter
class instance can be created via the ConverterFactory
. Once created it can be used to create intermodal (network) readers and writers that in turn can be offered to this converter to convert from the reader’s native format to the writer’s desired format.
Via its .create_reader(+)
and .create_writer(+)
methods, the converter can manufacture readers and writers of supported types. The reader takes an IntermodalReaderType
while the writer takes an IntermodalWriterType
to indicate what reader/writer is to be created. The result is an instance of the desired reader/writer. The user then can/should configure the reader/writer based on the available settings. Once configured, the actual conversion can be performed through this converter by providing the created reader/writer to the .convert(+)
method.
The main difference between a regular network reader/writer conversion and an intermodal reader/writer conversion is the support for intermodality, e.g., transfers between different modes are supported at transfer locations. These locations - in Planit - are referred to as transfer zones and are part of the zoning on top of the networks. Access to the underlying networks is facilitated by connectoids that allow a mode to access the transfer zone from a physical node/link segment. When different modes specify connectoids to the same transfer zone a transfer can be accommodated, e.g., when a bus stops on the road (bus connectoid) next to a train platform (transfer zone) such that passangers can move from bus to train, when the train stops on the tracks (train connectoid) next to the platform. Therefore an intermodal converter not only converts a physicla network, but also the transfer zone infrastructure and connectoids associated with it (possible also groupings of transfer zones in transfer zone groups).
The user is expected to configure each reader/writers minimum required settings, often involving setting input/output file locations and/or directories for example. For each reader/writer these minimum user configuration actions are clearly indicated. Failing to do so will cause the conversion to fail as information is missing.
NetworkConverter
exposes the following methods
Name | Description |
---|---|
.create_reader(+) |
Create a new intermodal reader based on the provided IntermodalReaderType |
.create_writer(+) |
Create a new intermodal writer based on the provided IntermodalWriterType |
.convert(+) |
Convert the intermodal reader’s input into the intermodal writer’s output format |
N/A
from planit import *
# create an intermodal converter
planit_instance = Planit()
intermodal_converter = planit_instance.converter_factory.create(ConverterType.NETWORK)
# example Open Street Map (OSM) intermodal reader
osm_reader = intermodal_converter.create_reader(IntermodalReaderType.OSM, "<country_name>")
osm_reader.settings.set_input_file("<path_to_input_file>")
# example Planit intermodal writer
planit_writer = intermodal_converter.create_writer(IntermodalReaderType.PLANIT)
planit_writer.settings.set_output_directory("<path_to_output_dir>")
planit_writer.settings.set_country("<country_name>")
# perform conversion
intermodal_converter.convert(osm_reader,matsim_writer)
ConverterFactory
for the converter factory to create other types of converters
IntermodalReaderType
for the supported intermodal reader types
IntermodalWriterType
for the supported intermodal writer types
Class IntermodalConverter
in converter.py
IntermodalConverter method
IntermodalConverter reader factory method
IntermodalConverter writer factory method