Class: QgsNominatimGeocoder¶
A geocoder which uses the Nominatim geocoding API to retrieve results.
This geocoder utilizes the Nominatim geocoding API in order to geocode strings.
Warning
The user is responsible for respecting the usage policy when using the default OpenStreetMap-run server.
Added in version 3.18.
Class Hierarchy¶
Base classes¶
Interface for geocoders. |
Methods
Returns the optional region bias which will be used to prioritize results in a certain region. |
|
Returns the API endpoint used for requests. |
|
Converts a JSON result returned from the Nominatim service to a geocoder result object. |
|
Returns the URL generated for geocoding the specified address. |
|
Returns the number of requests per seconds to the endpoint. |
|
Sets the optional region bias which will be used to prioritize results in a certain region. |
|
Sets a specific API endpoint to use for requests. |
|
Sets the number of request per seconds to the endpoint. |
- class qgis.core.QgsNominatimGeocoder[source]¶
Bases:
QgsGeocoderInterface
- __init__(countryCodes: str | None = '', endpoint: str | None = '')
Constructor for QgsNominatimGeocoder.
Optionally,
countryCodes
can be specified to restrict results to one or more countries. The codes must be in ISO 3166-1alpha2 code and comma-separated.The optional
endpoint
argument can be used to specify a non-default endpoint to use for request.- Parameters:
countryCodes (Optional[str] = '')
endpoint (Optional[str] = '')
- __init__(a0: QgsNominatimGeocoder)
- Parameters:
a0 (QgsNominatimGeocoder)
- countryCodes(self) str [source]¶
Returns the optional region bias which will be used to prioritize results in a certain region.
See also
- Return type:
str
- jsonToResult(self, json: Dict[str, Any]) QgsGeocoderResult [source]¶
Converts a JSON result returned from the Nominatim service to a geocoder result object.
- Parameters:
json (Dict[str, Any])
- Return type:
- requestUrl(self, address: str | None, bounds: QgsRectangle = QgsRectangle()) QUrl [source]¶
Returns the URL generated for geocoding the specified
address
.- Parameters:
address (Optional[str])
bounds (
QgsRectangle
= QgsRectangle())
- Return type:
QUrl
- requestsPerSecond(self) float [source]¶
Returns the number of requests per seconds to the endpoint.
See also
- Return type:
float
- setCountryCodes(self, countryCodes: str | None)[source]¶
Sets the optional
region
bias which will be used to prioritize results in a certain region.The
region
argument must be set to a two letter country code top-level domain value, e.g. “gb” for Great Britain.See also
- Parameters:
countryCodes (Optional[str])
- setEndpoint(self, endpoint: str | None)[source]¶
Sets a specific API
endpoint
to use for requests. This is for internal testing purposes only.See also
- Parameters:
endpoint (Optional[str])