.create_writer(+)

NetworkConverter writer factory method
Description

The factory method that allows you to create (manufacture) network writer instances of a chosen type. Currently, the following options are supported:

Each network writer can be configured further via its settings, where each type of network writer exposes different settings depending on its type

Signature

.create_writer(network_writer_type:NetworkWriterType)

with

Parameter Type Unit Compulsory Description
network_writer_type NetworkWriterType.<enum> None YES Type of network writer to create

Return type

NetworkWriter implementation

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(osm_reader,planit_writer)

See also

NetworkWriterType.<enum> for the various network writer types available
MatsimNetworkWriter for more information on the MATSim network writer
PlanitNetworkWriter for more information on the PLANit network writer

Source code

Class NetworkConverter in converter.py