QGIS API Documentation 4.3.0-Master (d3b565c628d)
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
19
21
22#include <QString>
23
24// this file breaks cppcheck ast parsing
25#define EXCLUDE_CPPCHECK
26#ifdef EXCLUDE_CPPCHECK
27
28#include <QString>
29
30using namespace Qt::StringLiterals;
31
33
34QgsBatchNominatimGeocodeAlgorithm::QgsBatchNominatimGeocodeAlgorithm()
35 : QgsBatchGeocodeAlgorithm( &mNominatimGeocoder )
36{}
37
38QString QgsBatchNominatimGeocodeAlgorithm::name() const
39{
40 return u"batchnominatimgeocoder"_s;
41}
42
43QString QgsBatchNominatimGeocodeAlgorithm::displayName() const
44{
45 return QObject::tr( "Batch Nominatim geocoder" );
46}
47
48QStringList QgsBatchNominatimGeocodeAlgorithm::tags() const
49{
50 return QObject::tr( "geocode,nominatim,batch,bulk,address,match" ).split( ',' );
51}
52
53QgsCoordinateReferenceSystem QgsBatchNominatimGeocodeAlgorithm::outputCrs( const QgsCoordinateReferenceSystem &inputCrs ) const
54{
55 mOutputCrs = inputCrs.isValid() ? inputCrs : QgsCoordinateReferenceSystem( u"EPSG:4326"_s );
56 return mOutputCrs;
57}
58
59QgsBatchNominatimGeocodeAlgorithm *QgsBatchNominatimGeocodeAlgorithm::createInstance() const
60{
61 return new QgsBatchNominatimGeocodeAlgorithm();
62}
63
64QString QgsBatchNominatimGeocodeAlgorithm::shortHelpString() const
65{
66 return QObject::tr(
67 "This algorithm performs batch geocoding using the <a href=\"https://nominatim.qgis.org/\">Nominatim</a> service against an input layer string field.\n\n"
68 "The output layer will have a point geometry reflecting the geocoded location as well as a number of attributes associated to the geocoded location."
69 );
70}
71
72QString QgsBatchNominatimGeocodeAlgorithm::shortDescription() const
73{
74 return QObject::tr( "Geocodes features in a vector layer using the Nominatim service." );
75}
76
77bool QgsBatchNominatimGeocodeAlgorithm::prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
78{
79 QGS_MARK_ALGORITHM_SOURCE
80
81 feedback->pushInfo(
82 QObject::tr(
83 "The Nominatim geocoder data is made available by OpenStreetMap Foundation and contributors. "
84 "It is provided under the ODbL license which requires to share alike. Visit https://nominatim.org/ to learn more."
85 )
86 );
87 return QgsBatchGeocodeAlgorithm::prepareAlgorithm( parameters, context, feedback );
88}
89
91
92#endif
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.
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.