.create(+)

ConverterFactory factory method

Description

The factory method that allows you to create (manufacture) converter instances of a chosen type. BAsed on the created converter, instances of compatible readers and writers can then be creted.

Currently, the following options are supported:

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, as well as (optionally) services running on the network

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
ZoningConverter instance or
DemandsConverter instance or
IntermodalConverter instance or

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
ZoningConverter for more information on zoning converters
DemandsConverter for more information on demands converters
IntermodalConverter for more information on intermodal converters

Source code

Class ConverterFactory in converter.py