.set_bounding_box(+)
Description
By default the entire OSM file that is provided will be parsed, unless the user specifies a smaller bounding box via this method. Only OSM nodes (and therefore ways and relations) within this bounding box are parsed.
If the parser finds that OSM ways have to be truncated because some OSM nodes are not available because they fall outside the bounding box, but are present within the file the user can take the following action. The reader will log the OSM ways with missing nodes. the user can then mark these OSM ways via
.network_settings.set_keep_osm_ways_outside_bounding_box(+)
and the reader will ensure the entire OSM way becomes available even if it partly falls outside the bounding box.
Signature
.set_bounding_box(x1, x2, y1, y2)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
x1 |
Float |
None |
N/A | First x coordinate (longitude) of bounding box |
21 |
Float |
None |
N/A | Second x coordinate (longitude) of bounding box |
x1 |
Float |
None |
N/A | First y coordinate (latitude) of bounding box |
x1 |
Float |
None |
N/A | second y coordinate (latitude) of bounding box |
Return type
N/A
Example 1
from planit import *
# create an intermodal 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>")
# set bounding box and mark some ways to be kept even though they partially fall outside this box
osm_reader.settings.set_bounding_box(144.948083, 144.975849, -37.823582, -37.808292)
osm_reader.settings.network_settings.set_keep_osm_ways_outside_bounding_box([28919629,45526180])
See also
.network_settings.set_keep_osm_ways_outside_bounding_box(+)
Source code
Class OsmIntermodalReaderSettingsWrapper
in converterwrappers.py