.set_input_file(+)
OsmNetworkReaderSettings method
Description
Set the input file to parse by the OsmNetworkReader
. This is a mandatory setting the user is expected to set. The Planit OsmNetworkReader
supports
- OSM XML input files, see https://wiki.openstreetmap.org/wiki/OSM_XML
- OSM PBF input files, see https://wiki.openstreetmap.org/wiki/PBF_Format
It is recommended to use the PBF files since they are more compact.
Make sure the input file is locally available and you have access rights to read the file from where the OsmNetworkReader
is running.
Signature
.set_input_file(input_file:str)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
input_file |
String |
None |
N/A | The input file 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_file("<path_to_input_file>")
# indicate to remove dangling subnetworks explicitly
osm_reader.set_remove_dangling_subnetworks(True)
# Only keep networks between 20 (default) and 100 vertices
osm_reader.set_always_keep_largest_subnetwork(False)
osm_reader.set_discard_dangling_networks_above(100)
See also
.set_input_source(+)
for URL streaming based input
Source code
Class OsmNetworkReaderSettingsWrapper
in converterwrappers.py