.set_country(+)
Description
Set the destination country of the to be generated Planit XML network file by the PlanitNetworkWriter
.
This country name is used to determine the best possible coordinate reference system (projection) to use for
the geometry information of the network.
If the country is not set by the user, the choice for the destination coordinate reference system is based on the coordinate reference system of the source network that is to be persisted. This is likely sufficient in most cases, but sometimes a country specific projection is required in which case the country can be provided here.
Whenever a country name is to be supplied, make sure this name complies with the ISO 3166 standard (see for example https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes ).
Signature
.set_country(country_name:str)
with
Parameter | Type | Unit | Default | Description |
---|---|---|---|---|
country_name |
String |
None |
Context dependent | The destination country name (ISO 3166) |
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)
# 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>")
# Planit network writer
planit_writer = network_converter.create_writer(NetworkWriterType.PLANIT)
planit_writer.settings.set_output_directory("<path_to_output_dir>")
# Set country explicitly to Australia: Australian Lambert projection will be adopted
planit_writer.settings.set_country("Australia")
# perform conversion
network_converter.convert(osm_reader,planit_writer)
See also
N/A
Source code
Class WriterSettingsWrapper
in converterwrappers.py