.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:MATSIM
generates anMatsimIntermodalWriter
instance to persist MATSIM networksIntermodalWriterType:PLANIT
generates aPlanitIntermodalWriter
instance to persist intermodal networks 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
PlanitIntermodalWriter
for more information on the Planit intermodal writer
Source code
Class NetworkConverter
in converter.py
Last modified January 1, 0001