.set_input_source(+)

OsmIntermodalReaderSettings method

Description

Set the input source which is not a file to parse by the OsmIntermodalReader. This is a mandatory setting the user is expected to set (unless .set_input_file(+) is used). The Planit OsmIntermodalReader supports String based URLs as sources, e.g.

  • "https://api.openstreetmap.org/api/0.6/map?bbox=13.465661,52.504055,13.469817,52.506204"

In the above example the 0.6 version of the OSM RESTful API is used to extract an XML stream for the given bounding box. The PLANit OSM reader is able to parse this stream as if it is a local file.

Signature

.set_input_source(input_source:str)

with

Parameter Type Unit Default Description
input_source String None N/A The input source URL to extract the network from

Return type

N/A

Example 1

from planit import *

# create a network 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_source("<URL_to_input_source>")

# example only has foot paths, so only activate those modes and types 
osm_reader.settings.deactivate_all_osm_way_types_except(["footway"])
osm_reader.settings.highway_settings.deactivate_all_road_modes_except(["foot"])

See also

Source code

Class OsmNetworkReaderSettingsWrapper in converterwrappers.py