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()