set_extent_to_locationο
- Maps.set_extent_to_location(location, annotate=False, user_agent=None)ο
Set the map-extent based on a given location query.
The bounding-box is hereby resolved via the OpenStreetMap Nominatim service.
Note
The OSM Nominatim service has a strict usage policy that explicitly disallows βheavy usageβ (e.g.: an absolute maximum of 1 request per second).
EOMaps caches requests so using a location multiple times in the same session does not cause multiple requests!
- For more details, see:
https://operations.osmfoundation.org/policies/nominatim/ https://openstreetmap.org/copyright
- Parameters:
location (str) β
An arbitrary string used to identify the region of interest. (e.g. a country, district, address etc.)
- For example:
βAustriaβ, βViennaβ
annotate (bool, optional) β Indicator if an annotation should be added to the center of the identified location or not. The default is False.
user_agent (str, optional) β The user-agent used for the Nominatim request
Examples
>>> m = Maps() >>> m.set_extent_to_location("Austria") >>> m.add_feature.preset.countries()
>>> m = Maps(Maps.CRS.GOOGLE_MERCATOR) >>> m.set_extent_to_location("Vienna") >>> m.add_wms.OpenStreetMap.add_layer.default()