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