.create_writer(+)
IntermodalConverter writer factory method
Description
The factory method that allows you to create (manufacture) intermodal writer instances of a chosen type. Currently, the following options are supported:
IntermodalWriterType:MATSIMgenerates anMatsimIntermodalWriterinstance to persist MATSIM networks and transit schedulesIntermodalWriterType:SHAPEgenerates anGeometryIntermodalWriterinstance to persist SHAPE files of all PLANit’s main componentsIntermodalWriterType:PLANITgenerates aPlanitIntermodalWriterinstance to persist intermodal networks and services in the native PLANit format
Each intermodal writer can be configured further via its settings, where each type of writer exposes different settings depending on its type.
Signature
.create_writer(intermodal_writer_type:IntermodalWriterType)
with
| Parameter | Type | Unit | Compulsory | Description |
|---|---|---|---|---|
intermodal_writer_type |
IntermodalWriterType.<enum> |
None |
YES | Type of intermodal writer to create |
Return type
IntermodalWriter implementation
Example 1
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)
See also
IntermodalWriterType.<enum> for the various intermodal writer types available
MatsimIntermodalWriter for more information on the MATSim intermodal writer
GeoioIntermodalWriter for more information on the Shape file intermodal writer
PlanitIntermodalWriter for more information on the PLANit intermodal writer
Source code
Class IntermodalConverter in converter.py