QGIS API Documentation 3.99.0-Master (26c88405ac0)
Loading...
Searching...
No Matches
qgsgooglemapsgeocoder.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgooglemapsgeocoder.h
3 ---------------
4 Date : November 2020
5 Copyright : (C) 2020 by Nyall Dawson
6 Email : nyall dot dawson 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 QGSGOOGLEMAPSGEOCODER_H
17#define QGSGOOGLEMAPSGEOCODER_H
18
19#include "qgis_core.h"
20#include "qgsgeocoder.h"
21
22#include <QMutex>
23
41{
42
43 public:
44
55 QgsGoogleMapsGeocoder( const QString &apiKey, const QString &regionBias = QString() );
56
57 Flags flags() const override;
58 QgsFields appendedFields() const override;
59 Qgis::WkbType wkbType() const override;
60 QList< QgsGeocoderResult > geocodeString( const QString &string, const QgsGeocoderContext &context, QgsFeedback *feedback = nullptr ) const override;
61
65 QUrl requestUrl( const QString &address, const QgsRectangle &bounds = QgsRectangle() ) const;
66
70 QgsGeocoderResult jsonToResult( const QVariantMap &json ) const;
71
75 void setEndpoint( const QString &endpoint );
76
82 QString apiKey() const;
83
91 void setApiKey( const QString &key );
92
98 QString region() const;
99
108 void setRegion( const QString &region );
109
110 private:
111
112 QString mApiKey;
113 QString mRegion;
114 QString mEndpoint;
115
116 static QReadWriteLock sMutex;
117
118};
119
120#endif // QGSGOOGLEMAPSGEOCODER_H
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition qgis.h:277
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.
void setEndpoint(const QString &endpoint)
Sets a specific API endpoint to use for requests.
QgsGeocoderResult jsonToResult(const QVariantMap &json) const
Converts a JSON result returned from the Google Maps service to a geocoder result object.
QString apiKey() const
Returns the API key which will be used when accessing the Google Maps API.
QString region() const
Returns the optional region bias which will be used to prioritize results in a certain region.
QUrl requestUrl(const QString &address, const QgsRectangle &bounds=QgsRectangle()) const
Returns the URL generated for geocoding the specified address.
QgsGoogleMapsGeocoder(const QString &apiKey, const QString &regionBias=QString())
Constructor for QgsGoogleMapsGeocoder.
void setRegion(const QString &region)
Sets the optional region bias which will be used to prioritize results in a certain region.
void setApiKey(const QString &key)
Sets the API key to use when accessing the Google Maps API.
A rectangle specified with double values.