QGIS API Documentation  3.20.0-Odense (decaadbb31)
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 
27 QgsBatchNominatimGeocodeAlgorithm::QgsBatchNominatimGeocodeAlgorithm()
28  : QgsBatchGeocodeAlgorithm( &mNominatimGeocoder )
29 {
30 }
31 
32 QString QgsBatchNominatimGeocodeAlgorithm::name() const
33 {
34  return QStringLiteral( "batchnominatimgeocoder" );
35 }
36 
37 QString QgsBatchNominatimGeocodeAlgorithm::displayName() const
38 {
39  return QObject::tr( "Batch Nominatim geocoder" );
40 }
41 
42 QStringList QgsBatchNominatimGeocodeAlgorithm::tags() const
43 {
44  return QObject::tr( "geocode,nominatim,batch,bulk,address,match" ).split( ',' );
45 }
46 
47 QgsBatchNominatimGeocodeAlgorithm *QgsBatchNominatimGeocodeAlgorithm::createInstance() const
48 {
49  return new QgsBatchNominatimGeocodeAlgorithm();
50 }
51 
52 QString QgsBatchNominatimGeocodeAlgorithm::shortHelpString() const
53 {
54  return QObject::tr( "This algorithm performs batch geocoding using the <a href=\"#\">Nominatim</a> service against an input layer string field.\n\n"
55  "The output layer will have a point geometry reflecting the geocoded location as well as a number of attributes associated to the geocoded location." );
56 }
57 
58 bool QgsBatchNominatimGeocodeAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
59 {
60  feedback->pushInfo( QObject::tr( "The Nominatim geocoder data is made available by OpenStreetMap Foundation and contributors. "
61  "It is provided under the ODbL license which requires to share alike. Visit https://nominatim.org/ to learn more." ) );
62  return QgsBatchGeocodeAlgorithm::prepareAlgorithm( parameters, context, feedback );
63 }
64 
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.
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.