.set_always_keep_largest_subnetwork(+)
OsmNetworkReaderSettings method
Description
When dangling (sub)networks are marked to be removed, the user can configure if the largest subnetwork is always to be kept. By default this is always set to true since the largest subnetwork is the main network that is parsed.
Signature
.set_always_keep_largest_subnetwork(keep:bool)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
keep |
Boolean |
None |
True |
Indicate to keep the largest (sub)network or not |
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_remove_dangling_subnetworks(+)
.set_discard_dangling_networks_above(+)
Source code
Class OsmNetworkReaderSettingsWrapper
in converterwrappers.py