QGIS API Documentation 3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
qgsnominatimgeocoder.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsnominatimgeocoder.h
3 ---------------
4 Date : December 2020
5 Copyright : (C) 2020 by Mathieu Pellerin
6 Email : nirvn dot asia at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSNOMINATIMGEOCODER_H
17#define QGSNOMINATIMGEOCODER_H
18
19#include "qgis_core.h"
20#include "qgsgeocoder.h"
21
22#include <QMutex>
23
37{
38
39 public:
40
49 QgsNominatimGeocoder( const QString &countryCodes = QString(), const QString &endpoint = QString() );
50
51 Flags flags() const override;
52 QgsFields appendedFields() const override;
53 Qgis::WkbType wkbType() const override;
54 QList< QgsGeocoderResult > geocodeString( const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback = nullptr ) const override;
55
59 QUrl requestUrl( const QString &address, const QgsRectangle &bounds = QgsRectangle() ) const;
60
64 QgsGeocoderResult jsonToResult( const QVariantMap &json ) const;
65
71 QString endpoint() const;
72
78 void setEndpoint( const QString &endpoint );
79
85 double requestsPerSecond() const { return mRequestsPerSecond; }
86
93 void setRequestsPerSecond( double number ) { mRequestsPerSecond = number; }
94
100 QString countryCodes() const;
101
110 void setCountryCodes( const QString &countryCodes );
111
112 private:
113
114 QString mCountryCodes;
115 QString mEndpoint;
116 double mRequestsPerSecond = 1;
117
118 static QMutex sMutex;
119
120 static qint64 sLastRequestTimestamp;
121
122};
123
124#endif // QGSNOMINATIMGEOCODER_H
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:201
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Container of fields for a vector layer.
Definition qgsfields.h:46
Encapsulates the context of a geocoding operation.
Interface for geocoders.
Definition qgsgeocoder.h:37
virtual Flags flags() const =0
Returns the geocoder's capability flags.
virtual Qgis::WkbType wkbType() const
Returns the WKB type of geometries returned by the geocoder.
virtual QList< QgsGeocoderResult > geocodeString(const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback=nullptr) const
Geocodes a string.
virtual QgsFields appendedFields() const
Returns a set of newly created fields which will be appended to existing features during the geocode ...
QFlags< Flag > Flags
Definition qgsgeocoder.h:47
Represents a matching result from a geocoder search.
A geocoder which uses the Nominatim geocoding API to retrieve results.
double requestsPerSecond() const
Returns the number of requests per seconds to the endpoint.
void setRequestsPerSecond(double number)
Sets the number of request per seconds to the endpoint.
A rectangle specified with double values.