.create(+)
Description
The factory method that allows you to create (manufacture) converter instances of a chosen type. Currently the following options are supported:
ConverterType:NETWORKgenerates aNetworkConverterinstanceConverterType:INTERMODALgenerates anIntermodalConverterinstance
A network converter can convert network infrastructure whereas an intermodal converter not only converts network infrastructure but also supports transfer infrastructure such as platforms, poles, stations where transfers between modes can occur, so called “Transfer zones” in Planit terminology.
Signature
.create(converter_type:ConverterType)
with
| Parameter | Type | Unit | Compulsory | Description |
|---|---|---|---|---|
converter_type |
ConverterType.<enum> |
None |
YES | Type of converter to create |
Return type
NetworkConverter instance
or
IntermodalConverter instance
Example 1
from planit import *
# create a network converter
planit_instance = Planit()
network_converter = planit_instance.converter_factory.create(ConverterType.NETWORK)
# example Open Street Map (OSM) network reader
osm_reader = network_converter.create_reader(NetworkReaderType.OSM, "<country_name>")
osm_reader.settings.set_input_file("<path_to_input_file>")
# example Planit network writer
planit_writer = network_converter.create_writer(NetworkWriterType.PLANIT)
planit_writer.settings.set_output_directory("<path_to_output_dir>")
planit_writer.settings.set_country("<country_name>")
# perform conversion
network_converter.convert(reader,writer)
See also
ConverterType.<enum> for the various converters available
NetworkConverter for more information on network converters
IntermodalConverter for more information on intermodal converters
Source code
Class ConverterFactory in converter.py