.set_input_source(+)
OsmNetworkReaderSettings method
Description
Set the input source which is not a file to parse by the OsmNetworkReader
. This is a mandatory setting the user is expected to set (unless .set_input_file(+)
is used). The Planit OsmNetworkReader
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 network 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()
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_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
.set_input_file(+)
for file based input
Source code
Class OsmNetworkReaderSettingsWrapper
in converterwrappers.py