IntermodalConverter

IntermodalConverter instance

The IntermodalConverter class instance can be created via the ConverterFactory. Once created it can be used to create intermodal (combined network and zoning, with optional service network and routes services) 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 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 passengers can move from bus to train, where a train then stops on the tracks (train connectoid) next to the platform. Therefore, an intermodal converter not only converts a physical network, but also the transfer zone infrastructure and connectoids associated with it (possible also groupings of transfer zones in transfer zone groups).

In addition to this, two types of conversion can be performed: (i) a conversion for - the above-mentioned - infrastructure only, i.e., roads, platforms, poles, or (ii) a conversion of both physical infrastructure as well as the services running on this infrastructure. In the latter case two additional components are read and written, namely a service network, and routed services that run on a service network.

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.

Because each intermodal reader/writer comprises multiple readers/writers, settings are split by the underlying sub-readers and writers, e.g., when accessing the settings, each settings provides access to other settings specific to the network, zoning, and/or service network and or services configuration.

Methods

IntermodalConverter 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 input into writer’s output format excluding services
.convert_with_services(+) Convert the input into the writer’s output format including services

Properties

N/A

Example 1

from planit import *

# create an intermodal converter
planit_instance = Planit()
intermodal_converter = planit_instance.converter_factory.create(ConverterType.INTERMODAL)

# 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,planit_writer)

See also

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

Source code

Class IntermodalConverter in converter.py


.convert(+)

IntermodalConverter method

.create_reader(+)

IntermodalConverter reader factory method

.create_writer(+)

IntermodalConverter writer factory method