QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
A geocoder which uses the Nominatim geocoding API to retrieve results. More...
#include <qgsnominatimgeocoder.h>
Public Member Functions | |
QgsNominatimGeocoder (const QString &countryCodes=QString(), const QString &endpoint=QString()) | |
Constructor for QgsNominatimGeocoder. More... | |
QgsFields | appendedFields () const override |
Returns a set of newly created fields which will be appended to existing features during the geocode operation. More... | |
QString | countryCodes () const |
Returns the optional region bias which will be used to prioritize results in a certain region. More... | |
QString | endpoint () const |
Returns the API endpoint used for requests. More... | |
Flags | flags () const override |
Returns the geocoder's capability flags. More... | |
QList< QgsGeocoderResult > | geocodeString (const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback=nullptr) const override |
Geocodes a string. More... | |
QgsGeocoderResult | jsonToResult (const QVariantMap &json) const |
Converts a JSON result returned from the Nominatim service to a geocoder result object. More... | |
double | requestsPerSecond () const |
Returns the number of requests per seconds to the endpoint. More... | |
QUrl | requestUrl (const QString &address, const QgsRectangle &bounds=QgsRectangle()) const |
Returns the URL generated for geocoding the specified address. More... | |
void | setCountryCodes (const QString &countryCodes) |
Sets the optional region bias which will be used to prioritize results in a certain region. More... | |
void | setEndpoint (const QString &endpoint) |
Sets a specific API endpoint to use for requests. More... | |
void | setRequestsPerSecond (double number) |
Sets the number of request per seconds to the endpoint. More... | |
QgsWkbTypes::Type | wkbType () const override |
Returns the WKB type of geometries returned by the geocoder. More... | |
Public Member Functions inherited from QgsGeocoderInterface | |
virtual | ~QgsGeocoderInterface ()=default |
virtual QList< QgsGeocoderResult > | geocodeFeature (const QgsFeature &feature, const QgsGeocoderContext &context, QgsFeedback *feedback=nullptr) const |
Geocodes a feature. More... | |
Additional Inherited Members | |
Public Types inherited from QgsGeocoderInterface | |
enum class | Flag { GeocodesStrings = 1 << 0 , GeocodesFeatures = 1 << 1 } |
Capability flags for the geocoder. More... | |
A geocoder which uses the Nominatim geocoding API to retrieve results.
This geocoder utilizes the Nominatim geocoding API in order to geocode strings.
Definition at line 36 of file qgsnominatimgeocoder.h.
QgsNominatimGeocoder::QgsNominatimGeocoder | ( | const QString & | countryCodes = QString() , |
const QString & | endpoint = QString() |
||
) |
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.
Definition at line 34 of file qgsnominatimgeocoder.cpp.
|
overridevirtual |
Returns a set of newly created fields which will be appended to existing features during the geocode operation.
These fields will include any extra content returned by the geocoder, such as fields for accuracy of the match or correct attribute values.
Reimplemented from QgsGeocoderInterface.
Definition at line 48 of file qgsnominatimgeocoder.cpp.
QString QgsNominatimGeocoder::countryCodes | ( | ) | const |
Returns the optional region bias which will be used to prioritize results in a certain region.
Definition at line 241 of file qgsnominatimgeocoder.cpp.
QString QgsNominatimGeocoder::endpoint | ( | ) | const |
Returns the API endpoint used for requests.
Definition at line 231 of file qgsnominatimgeocoder.cpp.
|
overridevirtual |
Returns the geocoder's capability flags.
Implements QgsGeocoderInterface.
Definition at line 43 of file qgsnominatimgeocoder.cpp.
|
overridevirtual |
Geocodes a string.
If implemented by the geocoder (i.e. flags() returns the QgsGeocoderInterface::Flag::GeocodesStrings flag), a list of matching results will be returned.
The optional feedback argument can be used to provider cancellation support.
Reimplemented from QgsGeocoderInterface.
Definition at line 72 of file qgsnominatimgeocoder.cpp.
QgsGeocoderResult QgsNominatimGeocoder::jsonToResult | ( | const QVariantMap & | json | ) | const |
Converts a JSON result returned from the Nominatim service to a geocoder result object.
Definition at line 169 of file qgsnominatimgeocoder.cpp.
|
inline |
Returns the number of requests per seconds to the endpoint.
Definition at line 85 of file qgsnominatimgeocoder.h.
QUrl QgsNominatimGeocoder::requestUrl | ( | const QString & | address, |
const QgsRectangle & | bounds = QgsRectangle() |
||
) | const |
Returns the URL generated for geocoding the specified address.
Definition at line 146 of file qgsnominatimgeocoder.cpp.
void QgsNominatimGeocoder::setCountryCodes | ( | const QString & | countryCodes | ) |
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.
Definition at line 246 of file qgsnominatimgeocoder.cpp.
void QgsNominatimGeocoder::setEndpoint | ( | const QString & | endpoint | ) |
Sets a specific API endpoint to use for requests.
This is for internal testing purposes only.
Definition at line 236 of file qgsnominatimgeocoder.cpp.
|
inline |
Sets the number of request per seconds to the endpoint.
Definition at line 93 of file qgsnominatimgeocoder.h.
|
overridevirtual |
Returns the WKB type of geometries returned by the geocoder.
If this is not known in advance then QgsWkbTypes::Unknown should be returned (e.g. in the case that a geocoder may return different geometry types depending on the quality of the match).
Reimplemented from QgsGeocoderInterface.
Definition at line 67 of file qgsnominatimgeocoder.cpp.