OsmIntermodalReader

OsmIntermodalReader instance

The OsmIntermodalReader class instance can be created via the IntermodalConverter. It provides the functionality to parse an OSM network and public transport infrastructure (poles, platform) and persist it in PLANit (or other supported) format using an IntermodalWriter.

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

Defaults in OSM Intermodal Reader

The OSM intermodal 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. The defaults regarding the “regular” network infrastructure follow the OsmNetworkReader defaults. The defaults specific to the intermodal aspects of this reader can be found under the defaults indicated for the various OsmPublicTransportSettings methods.

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

Minimum configuration requirements

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

  • 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 OsmIntermodalReaderSettings to configure the reader

Example 1 - Minimum required settings

from planit import *

# create an intermodal converter
planit_instance = Planit()
intermodal_converter = planit_instance.converter_factory.create(ConverterType.INTERMODAL)

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

# 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,planit_writer)

See also

OsmIntermodalReaderSettings for configuration of the OSM intermodal (network) reader
ConverterFactory for the converter factory to create other types of converters
IntermodalReaderType for the supported intermodal reader types
IntermodalWriterType for the supported intermodal writer types
OsmNetworkReader defaults detailing network defaults

Source code

Class OsmIntermodalReaderWrapper in converterwrappers.py


.settings

OsmIntermodalReader property