.set_default_when_osm_highway_type_unsupported(+)
Description
Planit does not support all possible OSM highway types for parsing. It is therefore possible that - rarely - a piece of
road is encountered that has an unsupported type as its highway type. In that case the reader will map this unknown type
to a default type and mark it as unsupported. The OSM highway type to use as this default is user configurable,
the default being the tertiary
OSM highway type. Here this default can be set.
In case the user sets this to None
, any unsupported encounters will result in the road being ignored and not parsed.
The provided types need to be in line with the OSM highway types’ name as outlined by Open Street Maps, see also https://wiki.openstreetmap.org/wiki/Key:highway
Signature
.set_default_when_osm_highway_type_unsupported(osm_highway_type: str)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
osm_highway_type |
str |
tertiary |
N/A | OSM highway type to adopt when unsupported highway type is encountered |
Return type
N/A
Example 1
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>")
# set default to "primary" type
osm_reader.settings.highway_settings.set_default_when_osm_highway_type_unsupported("primary")
Example 2
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>")
# set default to ignore unsupported types
osm_reader.highway_settings.set_default_when_osm_highway_type_unsupported(None)
See also
N/A
Source code
Class OsmHighwaySettingsWrapper
in converterwrappers.py