QGIS API Documentation  3.21.0-Master (5b68dc587e)
Public Member Functions | Protected Member Functions | List of all members
QgsBatchGeocodeAlgorithm Class Reference

A base class for batch geocoder algorithms, which takes a QgsGeocoderInterface object and exposes it as a Processing algorithm for batch geocoding operations. More...

#include <qgsalgorithmbatchgeocode.h>

Inheritance diagram for QgsBatchGeocodeAlgorithm:
Inheritance graph
[legend]

Public Member Functions

 QgsBatchGeocodeAlgorithm (QgsGeocoderInterface *geocoder)
 Constructor for QgsBatchGeocodeAlgorithm. More...
 
QString group () const override
 Returns the name of the group this algorithm belongs to. More...
 
QString groupId () const override
 Returns the unique ID of the group this algorithm belongs to. More...
 
void initParameters (const QVariantMap &configuration=QVariantMap()) override
 Initializes any extra parameters added by the algorithm subclass. More...
 
QList< int > inputLayerTypes () const override
 Returns the valid input layer types for the source layer for this algorithm. More...
 
bool supportInPlaceEdit (const QgsMapLayer *layer) const override
 Checks whether this algorithm supports in-place editing on the given layer Default implementation for feature based algorithms run some basic compatibility checks based on the geometry type of the layer. More...
 
QStringList tags () const override
 Returns a list of tags which relate to the algorithm, and are used to assist users in searching for suitable algorithms. More...
 
- Public Member Functions inherited from QgsProcessingFeatureBasedAlgorithm
 QgsProcessingFeatureBasedAlgorithm ()=default
 Constructor for QgsProcessingFeatureBasedAlgorithm. More...
 
QgsProcessingAlgorithm::Flags flags () const override
 Returns the flags indicating how and when the algorithm operates and should be exposed to users. More...
 
- Public Member Functions inherited from QgsProcessingAlgorithm
 QgsProcessingAlgorithm ()=default
 Constructor for QgsProcessingAlgorithm. More...
 
 QgsProcessingAlgorithm (const QgsProcessingAlgorithm &other)=delete
 Algorithms cannot be copied - create() should be used instead. More...
 
virtual ~QgsProcessingAlgorithm ()
 
virtual QString asPythonCommand (const QVariantMap &parameters, QgsProcessingContext &context) const
 Returns a Python command string which can be executed to run the algorithm using the specified parameters. More...
 
virtual bool canExecute (QString *errorMessage=nullptr) const
 Returns true if the algorithm can execute. More...
 
virtual bool checkParameterValues (const QVariantMap &parameters, QgsProcessingContext &context, QString *message=nullptr) const
 Checks the supplied parameter values to verify that they satisfy the requirements of this algorithm in the supplied context. More...
 
int countVisibleParameters () const
 Returns the number of visible (non-hidden) parameters defined by this algorithm. More...
 
QgsProcessingAlgorithmcreate (const QVariantMap &configuration=QVariantMap()) const SIP_THROW(QgsProcessingException)
 Creates a copy of the algorithm, ready for execution. More...
 
virtual QWidget * createCustomParametersWidget (QWidget *parent=nullptr) const
 If an algorithm subclass implements a custom parameters widget, a copy of this widget should be constructed and returned by this method. More...
 
virtual QgsExpressionContext createExpressionContext (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeatureSource *source=nullptr) const
 Creates an expression context relating to the algorithm. More...
 
QgsProcessingParameterDefinitions destinationParameterDefinitions () const
 Returns a list of destination parameters definitions utilized by the algorithm. More...
 
virtual QString displayName () const =0
 Returns the translated algorithm name, which should be used for any user-visible display of the algorithm name. More...
 
bool hasHtmlOutputs () const
 Returns true if this algorithm generates HTML outputs. More...
 
virtual Q_DECL_DEPRECATED QString helpString () const
 Returns a localised help string for the algorithm. More...
 
virtual QString helpUrl () const
 Returns a url pointing to the algorithm's help page. More...
 
virtual QIcon icon () const
 Returns an icon for the algorithm. More...
 
QString id () const
 Returns the unique ID for the algorithm, which is a combination of the algorithm provider's ID and the algorithms unique name (e.g. More...
 
virtual QString name () const =0
 Returns the algorithm name, used for identifying the algorithm. More...
 
QgsProcessingAlgorithmoperator= (const QgsProcessingAlgorithm &other)=delete
 Algorithms cannot be copied- create() should be used instead. More...
 
const QgsProcessingOutputDefinitionoutputDefinition (const QString &name) const
 Returns a matching output by name. More...
 
QgsProcessingOutputDefinitions outputDefinitions () const
 Returns an ordered list of output definitions utilized by the algorithm. More...
 
const QgsProcessingParameterDefinitionparameterDefinition (const QString &name) const
 Returns a matching parameter by name. More...
 
QgsProcessingParameterDefinitions parameterDefinitions () const
 Returns an ordered list of parameter definitions utilized by the algorithm. More...
 
QVariantMap postProcess (QgsProcessingContext &context, QgsProcessingFeedback *feedback)
 Should be called in the main thread following the completion of runPrepared(). More...
 
bool prepare (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback)
 Prepares the algorithm for execution. More...
 
virtual QVariantMap preprocessParameters (const QVariantMap &parameters)
 Pre-processes a set of parameters, allowing the algorithm to clean their values. More...
 
QgsProcessingProviderprovider () const
 Returns the provider to which this algorithm belongs. More...
 
QVariantMap run (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback, bool *ok=nullptr, const QVariantMap &configuration=QVariantMap(), bool catchExceptions=true) const SIP_THROW(QgsProcessingException)
 Executes the algorithm using the specified parameters. More...
 
QVariantMap runPrepared (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)
 Runs the algorithm, which has been prepared by an earlier call to prepare(). More...
 
void setProvider (QgsProcessingProvider *provider)
 Associates this algorithm with its provider. More...
 
virtual QString shortDescription () const
 Returns an optional translated short description of the algorithm. More...
 
virtual QString shortHelpString () const
 Returns a localised short helper string for the algorithm. More...
 
virtual QString svgIconPath () const
 Returns a path to an SVG version of the algorithm's icon. More...
 
virtual bool validateInputCrs (const QVariantMap &parameters, QgsProcessingContext &context) const
 Checks whether the coordinate reference systems for the specified set of parameters are valid for the algorithm. More...
 

Protected Member Functions

QgsCoordinateReferenceSystem outputCrs (const QgsCoordinateReferenceSystem &inputCrs) const override
 Maps the input source coordinate reference system (inputCrs) to a corresponding output CRS generated by the algorithm. More...
 
QgsFields outputFields (const QgsFields &inputFields) const override
 Maps the input source fields (inputFields) to corresponding output fields generated by the algorithm. More...
 
QString outputName () const override
 Returns the translated, user visible name for any layers created by this algorithm. More...
 
QgsWkbTypes::Type outputWkbType (QgsWkbTypes::Type inputWkbType) const override
 Maps the input WKB geometry type (inputWkbType) to the corresponding output WKB type generated by the algorithm. More...
 
bool prepareAlgorithm (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) override
 Prepares the algorithm to run using the specified parameters. More...
 
QgsFeatureList processFeature (const QgsFeature &feature, QgsProcessingContext &, QgsProcessingFeedback *feedback) override
 Processes an individual input feature from the source. More...
 
- Protected Member Functions inherited from QgsProcessingFeatureBasedAlgorithm
void initAlgorithm (const QVariantMap &configuration=QVariantMap()) override
 Initializes the algorithm using the specified configuration. More...
 
virtual QString inputParameterDescription () const
 Returns the translated description of the parameter corresponding to the input layer. More...
 
virtual QString inputParameterName () const
 Returns the name of the parameter corresponding to the input layer. More...
 
virtual QgsProcessing::SourceType outputLayerType () const
 Returns the layer type for layers generated by this algorithm, if this is possible to determine in advance. More...
 
void prepareSource (const QVariantMap &parameters, QgsProcessingContext &context)
 Read the source from parameters and context and set it. More...
 
QVariantMap processAlgorithm (const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback) override SIP_THROW(QgsProcessingException)
 Runs the algorithm using the specified parameters. More...
 
virtual QgsFeatureRequest request () const
 Returns the feature request used for fetching features to process from the source layer. More...
 
virtual QgsFeatureSink::SinkFlags sinkFlags () const
 Returns the feature sink flags to be used for the output. More...
 
QgsProcessingAlgorithm::VectorProperties sinkProperties (const QString &sink, const QVariantMap &parameters, QgsProcessingContext &context, const QMap< QString, QgsProcessingAlgorithm::VectorProperties > &sourceProperties) const override
 Returns the vector properties which will be used for the sink with matching name. More...
 
QgsCoordinateReferenceSystem sourceCrs () const
 Returns the source's coordinate reference system. More...
 
virtual QgsProcessingFeatureSource::Flag sourceFlags () const
 Returns the processing feature source flags to be used in the algorithm. More...
 
- Protected Member Functions inherited from QgsProcessingAlgorithm
bool addOutput (QgsProcessingOutputDefinition *outputDefinition)
 Adds an output definition to the algorithm. More...
 
bool addParameter (QgsProcessingParameterDefinition *parameterDefinition, bool createOutput=true)
 Adds a parameter definition to the algorithm. More...
 
virtual QgsProcessingAlgorithmcreateInstance () const =0
 Creates a new instance of the algorithm class. More...
 
QgsAnnotationLayerparameterAsAnnotationLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to an annotation layer. More...
 
bool parameterAsBool (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static boolean value. More...
 
bool parameterAsBoolean (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static boolean value. More...
 
QColor parameterAsColor (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a color, or returns an invalid color if the parameter was not set. More...
 
QString parameterAsCompatibleSourceLayerPath (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr)
 Evaluates the parameter with matching name to a source vector layer file path of compatible format. More...
 
QString parameterAsCompatibleSourceLayerPathAndLayerName (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QStringList &compatibleFormats, const QString &preferredFormat=QString("shp"), QgsProcessingFeedback *feedback=nullptr, QString *layerName=nullptr)
 Evaluates the parameter with matching name to a source vector layer file path and layer name of compatible format. More...
 
QString parameterAsConnectionName (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a connection name string. More...
 
QgsCoordinateReferenceSystem parameterAsCrs (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a coordinate reference system. More...
 
QString parameterAsDatabaseTableName (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a database table name string. More...
 
QDateTime parameterAsDateTime (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a DateTime, or returns an invalid date time if the parameter was not set. More...
 
double parameterAsDouble (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static double value. More...
 
int parameterAsEnum (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a enum value. More...
 
QList< int > parameterAsEnums (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to list of enum values. More...
 
QString parameterAsEnumString (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static enum string. More...
 
QStringList parameterAsEnumStrings (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to list of static enum strings. More...
 
QString parameterAsExpression (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to an expression. More...
 
QgsRectangle parameterAsExtent (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
 Evaluates the parameter with matching name to a rectangular extent. More...
 
QgsCoordinateReferenceSystem parameterAsExtentCrs (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an extent parameter value. More...
 
QgsGeometry parameterAsExtentGeometry (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem())
 Evaluates the parameter with matching name to a rectangular extent, and returns a geometry covering this extent. More...
 
QStringList parameterAsFields (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a list of fields. More...
 
QString parameterAsFile (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a file/folder name. More...
 
QStringList parameterAsFileList (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a list of files (for QgsProcessingParameterMultipleLayers in QgsProcessing:TypeFile mode). More...
 
QString parameterAsFileOutput (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a file based output destination. More...
 
QgsGeometry parameterAsGeometry (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
 Evaluates the parameter with matching name to a geometry. More...
 
QgsCoordinateReferenceSystem parameterAsGeometryCrs (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Returns the coordinate reference system associated with a geometry parameter value. More...
 
int parameterAsInt (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static integer value. More...
 
QList< int > parameterAsInts (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a list of integer values. More...
 
QgsMapLayerparameterAsLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a map layer. More...
 
QList< QgsMapLayer * > parameterAsLayerList (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a list of map layers. More...
 
QgsPrintLayoutparameterAsLayout (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a print layout. More...
 
QgsLayoutItemparameterAsLayoutItem (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QgsPrintLayout *layout)
 Evaluates the parameter with matching name to a print layout item, taken from the specified layout. More...
 
QVariantList parameterAsMatrix (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a matrix/table of values. More...
 
QgsMeshLayerparameterAsMeshLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a mesh layer. More...
 
QString parameterAsOutputLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a output layer destination. More...
 
QgsPointXY parameterAsPoint (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem()) const
 Evaluates the parameter with matching name to a point. More...
 
QgsPointCloudLayerparameterAsPointCloudLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a point cloud layer. More...
 
QgsCoordinateReferenceSystem parameterAsPointCrs (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Returns the coordinate reference system associated with an point parameter value. More...
 
QList< double > parameterAsRange (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a range of values. More...
 
QgsRasterLayerparameterAsRasterLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a raster layer. More...
 
QString parameterAsSchema (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context)
 Evaluates the parameter with matching name to a database schema name string. More...
 
QgsFeatureSinkparameterAsSink (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context, QString &destinationIdentifier, const QgsFields &fields, QgsWkbTypes::Type geometryType=QgsWkbTypes::NoGeometry, const QgsCoordinateReferenceSystem &crs=QgsCoordinateReferenceSystem(), QgsFeatureSink::SinkFlags sinkFlags=QgsFeatureSink::SinkFlags(), const QVariantMap &createOptions=QVariantMap(), const QStringList &datasourceOptions=QStringList(), const QStringList &layerOptions=QStringList()) const SIP_THROW(QgsProcessingException)
 Evaluates the parameter with matching name to a feature sink. More...
 
QgsProcessingFeatureSourceparameterAsSource (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a feature source. More...
 
QString parameterAsString (const QVariantMap &parameters, const QString &name, const QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a static string value. More...
 
QgsVectorLayerparameterAsVectorLayer (const QVariantMap &parameters, const QString &name, QgsProcessingContext &context) const
 Evaluates the parameter with matching name to a vector layer. More...
 
virtual QVariantMap postProcessAlgorithm (QgsProcessingContext &context, QgsProcessingFeedback *feedback) SIP_THROW(QgsProcessingException)
 Allows the algorithm to perform any required cleanup tasks. More...
 
void removeParameter (const QString &name)
 Removes the parameter with matching name from the algorithm, and deletes any existing definition. More...
 

Additional Inherited Members

- Public Types inherited from QgsProcessingAlgorithm
enum  Flag {
  FlagHideFromToolbox = 1 << 1 , FlagHideFromModeler = 1 << 2 , FlagSupportsBatch = 1 << 3 , FlagCanCancel = 1 << 4 ,
  FlagRequiresMatchingCrs = 1 << 5 , FlagNoThreading = 1 << 6 , FlagDisplayNameIsLiteral = 1 << 7 , FlagSupportsInPlaceEdits = 1 << 8 ,
  FlagKnownIssues = 1 << 9 , FlagCustomException = 1 << 10 , FlagPruneModelBranchesBasedOnAlgorithmResults = 1 << 11 , FlagSkipGenericModelLogging = 1 << 12 ,
  FlagNotAvailableInStandaloneTool = 1 << 13 , FlagRequiresProject = 1 << 14 , FlagDeprecated = FlagHideFromToolbox | FlagHideFromModeler
}
 Flags indicating how and when an algorithm operates and should be exposed to users. More...
 
enum  PropertyAvailability { NotAvailable , Available }
 Property availability, used for QgsProcessingAlgorithm::VectorProperties in order to determine if properties are available or not. More...
 
- Static Protected Member Functions inherited from QgsProcessingAlgorithm
static QString invalidRasterError (const QVariantMap &parameters, const QString &name)
 Returns a user-friendly string to use as an error when a raster layer input could not be loaded. More...
 
static QString invalidSinkError (const QVariantMap &parameters, const QString &name)
 Returns a user-friendly string to use as an error when a sink parameter could not be created. More...
 
static QString invalidSourceError (const QVariantMap &parameters, const QString &name)
 Returns a user-friendly string to use as an error when a source parameter could not be loaded. More...
 
static QString writeFeatureError (QgsFeatureSink *sink, const QVariantMap &parameters, const QString &name)
 Returns a user-friendly string to use as an error when a feature cannot be written into a sink. More...
 

Detailed Description

A base class for batch geocoder algorithms, which takes a QgsGeocoderInterface object and exposes it as a Processing algorithm for batch geocoding operations.

Example

# create a class which implements the QgsGeocoderInterface interface:
class MyGeocoder(QgsGeocoderInterface):
def geocodeString(self, string, context, feedback):
# calculate and return results...
my_geocoder = MyGeocoder()
# create an algorithm which allows for batch geocoding operations using the custom geocoder interface
# and implement the few required pure virtual methods
class MyGeocoderAlgorithm(QgsBatchGeocodeAlgorithm):
def __init__(self):
super().__init__(my_geocoder)
def displayName(self):
return "My Geocoder"
def name(self):
return "my_geocoder_alg"
def createInstance(self):
return MyGeocoderAlgorithm()
# optionally, the group(), groupId(), tags(), shortHelpString() and other metadata style methods can be overridden and customized:
def tags(self):
return 'geocode,my service,batch'
A base class for batch geocoder algorithms, which takes a QgsGeocoderInterface object and exposes it ...
Interface for geocoders.
Definition: qgsgeocoder.h:37
Since
QGIS 3.18

Definition at line 68 of file qgsalgorithmbatchgeocode.h.

Constructor & Destructor Documentation

◆ QgsBatchGeocodeAlgorithm()

QgsBatchGeocodeAlgorithm::QgsBatchGeocodeAlgorithm ( QgsGeocoderInterface geocoder)

Constructor for QgsBatchGeocodeAlgorithm.

The geocoder must specify an instance of a class which implements the QgsGeocoderInterface interface. Ownership of geocoder is not transferred, and the caller must ensure that geocoder exists for the lifetime of this algorithm.

Definition at line 24 of file qgsalgorithmbatchgeocode.cpp.

Member Function Documentation

◆ group()

QString QgsBatchGeocodeAlgorithm::group ( ) const
overridevirtual

Returns the name of the group this algorithm belongs to.

This string should be localised.

See also
groupId()
tags()

Reimplemented from QgsProcessingAlgorithm.

Definition at line 36 of file qgsalgorithmbatchgeocode.cpp.

◆ groupId()

QString QgsBatchGeocodeAlgorithm::groupId ( ) const
overridevirtual

Returns the unique ID of the group this algorithm belongs to.

This string should be fixed for the algorithm, and must not be localised. The group id should be unique within each provider. Group id should contain lowercase alphanumeric characters only and no spaces or other formatting characters.

See also
group()

Reimplemented from QgsProcessingAlgorithm.

Definition at line 41 of file qgsalgorithmbatchgeocode.cpp.

◆ initParameters()

void QgsBatchGeocodeAlgorithm::initParameters ( const QVariantMap &  configuration = QVariantMap())
overridevirtual

Initializes any extra parameters added by the algorithm subclass.

There is no need to declare the input source or output sink, as these are automatically created by QgsProcessingFeatureBasedAlgorithm.

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 46 of file qgsalgorithmbatchgeocode.cpp.

◆ inputLayerTypes()

QList< int > QgsBatchGeocodeAlgorithm::inputLayerTypes ( ) const
overridevirtual

Returns the valid input layer types for the source layer for this algorithm.

By default vector layers with any geometry types (excluding non-spatial, geometryless layers) are accepted.

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 60 of file qgsalgorithmbatchgeocode.cpp.

◆ outputCrs()

QgsCoordinateReferenceSystem QgsBatchGeocodeAlgorithm::outputCrs ( const QgsCoordinateReferenceSystem inputCrs) const
overrideprotectedvirtual

Maps the input source coordinate reference system (inputCrs) to a corresponding output CRS generated by the algorithm.

The default behavior is that the algorithm maintains the same CRS as the input source.

This is called once by the base class when creating the output sink for the algorithm (i.e. it is not called once per feature processed).

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 98 of file qgsalgorithmbatchgeocode.cpp.

◆ outputFields()

QgsFields QgsBatchGeocodeAlgorithm::outputFields ( const QgsFields inputFields) const
overrideprotectedvirtual

Maps the input source fields (inputFields) to corresponding output fields generated by the algorithm.

The default behavior is that the algorithm maintains the same fields as are input. Algorithms which add, remove or modify existing fields should override this method and implement logic here to indicate which fields are output by the algorithm.

This is called once by the base class when creating the output sink for the algorithm (i.e. it is not called once per feature processed).

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 104 of file qgsalgorithmbatchgeocode.cpp.

◆ outputName()

QString QgsBatchGeocodeAlgorithm::outputName ( ) const
overrideprotectedvirtual

Returns the translated, user visible name for any layers created by this algorithm.

This name will be used as the default name when loading the resultant layer into a QGIS project.

Implements QgsProcessingFeatureBasedAlgorithm.

Definition at line 74 of file qgsalgorithmbatchgeocode.cpp.

◆ outputWkbType()

QgsWkbTypes::Type QgsBatchGeocodeAlgorithm::outputWkbType ( QgsWkbTypes::Type  inputWkbType) const
overrideprotectedvirtual

Maps the input WKB geometry type (inputWkbType) to the corresponding output WKB type generated by the algorithm.

The default behavior is that the algorithm maintains the same WKB type. This is called once by the base class when creating the output sink for the algorithm (i.e. it is not called once per feature processed).

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 93 of file qgsalgorithmbatchgeocode.cpp.

◆ prepareAlgorithm()

bool QgsBatchGeocodeAlgorithm::prepareAlgorithm ( const QVariantMap &  parameters,
QgsProcessingContext context,
QgsProcessingFeedback feedback 
)
overrideprotectedvirtual

Prepares the algorithm to run using the specified parameters.

Algorithms should implement their logic for evaluating parameter values here. The evaluated parameter results should be stored in member variables ready for a call to processAlgorithm().

The context argument specifies the context in which the algorithm is being run.

prepareAlgorithm should be used to handle any thread-sensitive preparation which is required by the algorithm. It will always be called from the same thread that context has thread affinity with. While this will generally be the main thread, it is not guaranteed. For instance, algorithms which are run as a step in a larger model or as a subcomponent of a script-based algorithm will call prepareAlgorithm from the same thread as that model/script it being executed in.

Note that the processAlgorithm step uses a temporary context with affinity for the thread in which the algorithm is executed, making it safe for processAlgorithm implementations to load sources and sinks without issue. Implementing prepareAlgorithm is only required if special thread safe handling is required by the algorithm.

Algorithm preparation progress should be reported using the supplied feedback object. Additionally, well-behaved algorithms should periodically check feedback to determine whether the algorithm should be canceled and exited early.

If the preparation was successful algorithms must return true. If a false value is returned this indicates that the preparation could not be completed, and the algorithm execution will be canceled.

Returns
true if preparation was successful.
See also
processAlgorithm()
postProcessAlgorithm()

Reimplemented from QgsProcessingAlgorithm.

Definition at line 79 of file qgsalgorithmbatchgeocode.cpp.

◆ processFeature()

QgsFeatureList QgsBatchGeocodeAlgorithm::processFeature ( const QgsFeature feature,
QgsProcessingContext context,
QgsProcessingFeedback feedback 
)
overrideprotectedvirtual

Processes an individual input feature from the source.

Algorithms should implement their logic in this method for performing the algorithm's operation (e.g. replacing the feature's geometry with the centroid of the original feature geometry for a 'centroid' type algorithm).

Implementations should return a list containing the modified feature. Returning an empty an list will indicate that this feature should be 'skipped', and will not be added to the algorithm's output. Subclasses can use this approach to filter the incoming features as desired.

Additionally, multiple features can be returned for a single input feature. Each returned feature will be added to the algorithm's output. This allows for "explode" type algorithms where a single input feature results in multiple output features.

The provided feedback object can be used to push messages to the log and for giving feedback to users. Note that handling of progress reports and algorithm cancellation is handled by the base class and subclasses do not need to reimplement this logic.

Algorithms can throw a QgsProcessingException if a fatal error occurred which should prevent the algorithm execution from continuing. This can be annoying for users though as it can break valid model execution - so use with extreme caution, and consider using feedback to instead report non-fatal processing failures for features instead.

Implements QgsProcessingFeatureBasedAlgorithm.

Definition at line 120 of file qgsalgorithmbatchgeocode.cpp.

◆ supportInPlaceEdit()

bool QgsBatchGeocodeAlgorithm::supportInPlaceEdit ( const QgsMapLayer layer) const
overridevirtual

Checks whether this algorithm supports in-place editing on the given layer Default implementation for feature based algorithms run some basic compatibility checks based on the geometry type of the layer.

Returns
true if the algorithm supports in-place editing
Since
QGIS 3.4

Reimplemented from QgsProcessingFeatureBasedAlgorithm.

Definition at line 65 of file qgsalgorithmbatchgeocode.cpp.

◆ tags()

QStringList QgsBatchGeocodeAlgorithm::tags ( ) const
overridevirtual

Returns a list of tags which relate to the algorithm, and are used to assist users in searching for suitable algorithms.

These tags should be localised.

Reimplemented from QgsProcessingAlgorithm.

Definition at line 31 of file qgsalgorithmbatchgeocode.cpp.


The documentation for this class was generated from the following files: