QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
qgsalgorithmbatchnominatimgeocode.cpp
Go to the documentation of this file.
1/***************************************************************************
2 qgsalgorithmbatchnominatimgeocode.cpp
3 ------------------
4 begin : December 2020
5 copyright : (C) 2020 by Mathieu Pellerin
6 email : nirvn dot asia at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
20#include "qgsgeocoder.h"
21#include "qgsgeocoderresult.h"
22#include "qgsgeocodercontext.h"
23#include "qgsvectorlayer.h"
24
26
27QgsBatchNominatimGeocodeAlgorithm::QgsBatchNominatimGeocodeAlgorithm()
28 : QgsBatchGeocodeAlgorithm( &mNominatimGeocoder )
29{
30}
31
32QString QgsBatchNominatimGeocodeAlgorithm::name() const
33{
34 return QStringLiteral( "batchnominatimgeocoder" );
35}
36
37QString QgsBatchNominatimGeocodeAlgorithm::displayName() const
38{
39 return QObject::tr( "Batch Nominatim geocoder" );
40}
41
42QStringList QgsBatchNominatimGeocodeAlgorithm::tags() const
43{
44 return QObject::tr( "geocode,nominatim,batch,bulk,address,match" ).split( ',' );
45}
46
47QgsCoordinateReferenceSystem QgsBatchNominatimGeocodeAlgorithm::outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const
48{
49 mOutputCrs = inputCrs.isValid() ? inputCrs : QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) );
50 return mOutputCrs;
51}
52
53QgsBatchNominatimGeocodeAlgorithm *QgsBatchNominatimGeocodeAlgorithm::createInstance() const
54{
55 return new QgsBatchNominatimGeocodeAlgorithm();
56}
57
58QString QgsBatchNominatimGeocodeAlgorithm::shortHelpString() const
59{
60 return QObject::tr( "This algorithm performs batch geocoding using the <a href=\"#\">Nominatim</a> service against an input layer string field.\n\n"
61 "The output layer will have a point geometry reflecting the geocoded location as well as a number of attributes associated to the geocoded location." );
62}
63
64bool QgsBatchNominatimGeocodeAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
65{
66 feedback->pushInfo( QObject::tr( "The Nominatim geocoder data is made available by OpenStreetMap Foundation and contributors. "
67 "It is provided under the ODbL license which requires to share alike. Visit https://nominatim.org/ to learn more." ) );
68 return QgsBatchGeocodeAlgorithm::prepareAlgorithm( parameters, context, feedback );
69}
70
A base class for batch geocoder algorithms, which takes a QgsGeocoderInterface object and exposes it ...
bool prepareAlgorithm(const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) override
Prepares the algorithm to run using the specified parameters.
This class represents a coordinate reference system (CRS).
bool isValid() const
Returns whether this CRS is correctly initialized and usable.
Contains information about the context in which a processing algorithm is executed.
Base class for providing feedback from a processing algorithm.
virtual void pushInfo(const QString &info)
Pushes a general informational message from the algorithm.