OsmNetworkReader

OsmNetworkReader instance

The OsmNetworkReader class instance can be created via the NetworkConverter. It provides the functionality to parse an OSM network in the PLANit format, and possible persist it in another format using a NetworkWriter. Once created the user can configure its settings.

All configuration of this reader is performed via its .settings property, providing access to the OsmNetworkReaderSettings.

Defaults in OSM Network Reader

The OSM reader relies on defaults whenever tagging information is absent, or assumed to revert to the implicit default as prescribed by OSM itself. Wherever possible this OSM reader aligns itself with the prescribed OSM defaults. In addition, the user can change these defaults if they deem this necessary. Detailed information on the adopted defaults can be found under; Defaults in the OSM Network Reader

If, after reading the documentation, you are still unsure what defaults Planit adopted, have a look at the generated logs. Planit will log the majority of the adopted defaults in its output when performing the OSM network reading.

Minimum configuration requirements

The user is required to explicitly configure at least the following settings on an OsmNetworkReader:

  • Set an InputFile via .settings.set_input_file(+), or alternatively,
  • Stream XML directly from an URL via .settings.set_input_source(+)

Methods

N/A

Properties

This class exposes the following properties:

Property Availability Description
.settings Always Access to OsmNetworkReaderSettings to configure the reader

Example 1 - Minimum required settings

from planit import *

# create a network converter
planit_instance = Planit()
network_converter = planit_instance.converter_factory.create(ConverterType.NETWORK)

# 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>")
#or: osm_reader.settings.set_input_source("<URL_to_input_source>")

# 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

OsmNetworkReaderSettings for configuration of the OSM network reader
ConverterFactory for the converter factory to create other types of converters
NetworkReaderType for the supported network reader types
NetworkWriterType for the supported network writer types
OSM Network Reader Defaults detailing defaults

Source code

Class OsmNetworkReaderWrapper in converterwrappers.py


.settings

OsmNetworkReader property

OSM Network Reader Defaults

Detailed information on the adopted defaults

Last modified January 1, 0001