.overwrite_mode_access_by_osm_way_id(+)

OsmNetworkReaderSettings method

Description

Option to overwrite the default (dis)allowed modes for a specific OSM way, indicated by its unique OSM way id. The user is expected to provide the modes that are allowed access implicitly defining the modes that are not allowed as well.

The OSM modes that are to be provided are based on the existing mode tags as used by Open Street Maps, see information on access on the OSM website for a listing of available modes: https://wiki.openstreetmap.org/wiki/Key:access

Note that this functionality is especially useful in case of tagging errors. For example if a road is marked as private without any explicit exceptions, the reader assumes access is not allowed to any mode (as specified by OSM), but this can be a tagging error, for example when a bus line uses this road, in this case the road should be accessible to buses despite being private. Use this functionality to make that happen.

We point out that here only single modes should be provided and not mode categories, e.g., “bus”, or “foot” is perfectly fine, but “motor_vehicle” is not because it represents more than one mode

You can check the location and tags of an OSM way very easily via any browser through https://www.openstreetmap.org/way/

Signature

.overwrite_mode_access_by_osm_way_id(osm_way_id:long, allowed_modes)

with

Parameter Type Unit Default Description
osm_way_id Long None N/A OSM way id to overwrite mode access for
allowed_modes List of String None N/A Explicitly allowed modes based on OSM modes

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)

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

# Explicitly allow bus and pedestrians on way with id 296601918l
osm_reader.overwrite_mode_access_by_osm_way_id(296601918l, ["bus", "foot"])

See also

N/A

Source code

Class OsmNetworkReaderSettingsWrapper in converterwrappers.py