QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
|
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. | |
QgsFields | appendedFields () const override |
Returns a set of newly created fields which will be appended to existing features during the geocode operation. | |
QString | countryCodes () const |
Returns the optional region bias which will be used to prioritize results in a certain region. | |
QString | endpoint () const |
Returns the API endpoint used for requests. | |
Flags | flags () const override |
Returns the geocoder's capability flags. | |
QList< QgsGeocoderResult > | geocodeString (const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback=nullptr) const override |
Geocodes a string. | |
QgsGeocoderResult | jsonToResult (const QVariantMap &json) const |
Converts a JSON result returned from the Nominatim service to a geocoder result object. | |
double | requestsPerSecond () const |
Returns the number of requests per seconds to the endpoint. | |
QUrl | requestUrl (const QString &address, const QgsRectangle &bounds=QgsRectangle()) const |
Returns the URL generated for geocoding the specified address. | |
void | setCountryCodes (const QString &countryCodes) |
Sets the optional region bias which will be used to prioritize results in a certain region. | |
void | setEndpoint (const QString &endpoint) |
Sets a specific API endpoint to use for requests. | |
void | setRequestsPerSecond (double number) |
Sets the number of request per seconds to the endpoint. | |
Qgis::WkbType | wkbType () const override |
Returns the WKB type of geometries returned by the geocoder. | |
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. | |
Additional Inherited Members | |
Public Types inherited from QgsGeocoderInterface | |
enum class | Flag { GeocodesStrings = 1 << 0 , GeocodesFeatures = 1 << 1 } |
Capability flags for the geocoder. More... | |
typedef QFlags< Flag > | Flags |
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 36 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 50 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 240 of file qgsnominatimgeocoder.cpp.
QString QgsNominatimGeocoder::endpoint | ( | ) | const |
Returns the API endpoint used for requests.
Definition at line 230 of file qgsnominatimgeocoder.cpp.
|
overridevirtual |
Returns the geocoder's capability flags.
Implements QgsGeocoderInterface.
Definition at line 45 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 74 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 168 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 148 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 245 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 235 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 69 of file qgsnominatimgeocoder.cpp.