OsmNetworkReaderSettings

OsmNetworkReaderSettings instance

The OsmNetworkReaderSettings instance is accessible via the OsmNetworkReader its .settings property. It allows the user to configure the OsmNetworkReader. We differentiate between:

  • General settings
  • Settings specific to certain OSM entities

All general settings are accessible directly via methods on this class. All specific settings require accessing a dedicated settings or configuration property within this class. Currently, the following specific settings properties are available:

The highway settings relate to all road infrastructure (including footways, bicycle paths, busways etc.). The railway settings relate to all track/rail based infrastructure (heavy rail, light rail, etc.), while the waterway settings deal with all water based routing and modes (ferries).

Within these settings, types of road/rail/water can be activated or deactivated, and modes can be added or removed if required.

The lane configuration settings relate to the user setting defaults for the number of lanes for the various road types, useful when - for example - they are not explicitly tagged in the network and the user is not happy with the defaults.

The terminology used within this settings class (highway, railway, waterway) is based on the naming conventions adopted by Open Street Maps and are not specific to PLANit.

Properties

This class exposes the following properties

Property Description
.highway_settings Settings specific to OSM entities tagged as highway=
.lane_configuration Settings specific to the configuration of OSM lanes in case tags are absent
.railway_settings Settings specific to OSM entities tagged as railway=
.waterway_settings Settings specific to OSM entities tagged as route=ferry and/or ferry=<highway_type>

Minimum configuration requirements

All methods marked as Compulsory=YES in the Methods section are expected to be configured by the user explicitly.

Methods

A OsmNetworkReaderSettings instance exposes the following methods. The Compulsory column indicates it the user is expected to configure this setting explicitly or not.

Name Compulsory Default Description
.activate_highway_parser(+) NO TRUE Parse highways or not (all non tracked roads are tagged as highways)
.activate_railway_parser(+) NO FALSE Parse railways or not (all tracked infrastructure falls under railways)
.activate_waterway_parser(+) NO FALSE Parse waterways or not (all “water” infrastructure falls under waterways)
.deactivate_all_osm_way_types_except(+) NO N/A Deactivate parsing all OSM way types except the ones flagged by user
.exclude_osm_ways_from_parsing(+) NO N/A Explicitly mark certain osm ways from being parsed by their OSM way id
.is_highway_parser_active() NO TRUE Verify if the highway parser is active or not
.is_railway_parser_active() NO TRUE/False Verify if the railway parser is active or not
.is_waterway_parser_active() NO False Verify if the waterway parser is active or not
.overwrite_mode_access_by_osm_way_id(+) NO N/A Explicitly override the allowed modes for a certain osm way by its OSM way id
.set_always_keep_largest_subnetwork(+) NO TRUE Indicate keep largest subnetwork when removing dangling subnetworks
.set_bounding_box(+) NO TRUE Mark a bounding box to which the reader is restricted within the OSM file
.set_discard_dangling_networks_above(+) NO Infinity Set threshold of nodes above which a dangling subnetwork is removed
.set_discard_dangling_networks_below(+) NO 20 Set threshold of nodes under which a dangling subnetwork is removed
.set_keep_osm_ways_outside_bounding_box(+) NO N/A Mark OSM ways to be kept even if they fall (partially) outside the user specified bounding box
.set_input_file(+) YES N/A Set the input file (local file based) to parse by the OSM network reader
.set_input_source(+) YES N/A Set the input source (URL streaming) to parse by the OSM network reader
.set_remove_dangling_subnetworks(+) NO TRUE Remove dangling subnetworks or not after parsing

Setting either the input file or input source suffices, both need not be set.

Example 1 - Minimum required settings

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>")
#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

OsmNetworkReader OSM network reader class these settings reside on

Source code

Class OsmNetworkReaderSettingsWrapper in converterwrappers.py


.activate_highway_parser(+)

OsmNetworkReaderSettings method

.activate_railway_parser(+)

OsmNetworkReaderSettings method

.activate_waterway_parser(+)

OsmNetworkReaderSettings method

.deactivate_all_osm_way_types_except(+)

OsmNetworkReaderSettings method

.exclude_osm_ways_from_parsing(+)

OsmNetworkReaderSettings method

.highway_settings

OsmNetworkReaderSettings property

.is_highway_parser_active()

OsmNetworkReaderSettings method

.is_railway_parser_active()

OsmNetworkReaderSettings method

.is_waterway_parser_active()

OsmNetworkReaderSettings method

.overwrite_mode_access_by_osm_way_id(+)

OsmNetworkReaderSettings method

.railway_settings

OsmNetworkReaderSettings property

.set_always_keep_largest_subnetwork(+)

OsmNetworkReaderSettings method

.set_bounding_box(+)

OsmNetworkReaderSettings method

.set_discard_dangling_networks_above(+)

OsmNetworkReaderSettings method

.set_discard_dangling_networks_below(+)

OsmNetworkReaderSettings method

.set_input_file(+)

OsmNetworkReaderSettings method

.set_input_source(+)

OsmNetworkReaderSettings method

.set_keep_osm_ways_outside_bounding_box(+)

OsmNetworkReaderSettings method

.set_remove_dangling_subnetworks(+)

OsmNetworkReaderSettings method

.waterway_settings

OsmNetworkReaderSettings property

OsmHighwaySettings

OsmHighwaySettings instance

OsmLaneConfiguration

OsmHighwaySettings instance

OsmRailwaySettings

OsmRailwaySettings instance

OsmWaterwaySettings

OsmWaterwaySettings instance