QGIS API Documentation  2.99.0-Master (19b062c)
Public Types | Public Member Functions | List of all members
QgsRasterCalculator Class Reference

Raster calculator class. More...

#include <qgsrastercalculator.h>

Public Types

enum  Result {
  Success = 0, CreateOutputError = 1, InputLayerError = 2, Canceled = 3,
  ParserError = 4, MemoryError = 5
}
 Result of the calculation. More...
 

Public Member Functions

 QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries)
 QgsRasterCalculator constructor. More...
 
 QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries)
 QgsRasterCalculator constructor. More...
 
int processCalculation (QgsFeedback *feedback=nullptr)
 Starts the calculation and writes a new raster. More...
 

Detailed Description

Raster calculator class.

Definition at line 49 of file qgsrastercalculator.h.

Member Enumeration Documentation

◆ Result

Result of the calculation.

Enumerator
Success 

Calculation successful.

CreateOutputError 

Error creating output data file.

InputLayerError 

Error reading input layer.

Canceled 

User canceled calculation.

ParserError 

Error parsing formula.

MemoryError 

Error allocating memory for result.

Definition at line 54 of file qgsrastercalculator.h.

Constructor & Destructor Documentation

◆ QgsRasterCalculator() [1/2]

QgsRasterCalculator::QgsRasterCalculator ( const QString &  formulaString,
const QString &  outputFile,
const QString &  outputFormat,
const QgsRectangle outputExtent,
int  nOutputColumns,
int  nOutputRows,
const QVector< QgsRasterCalculatorEntry > &  rasterEntries 
)

QgsRasterCalculator constructor.

Parameters
formulaStringformula for raster calculation
outputFileoutput file path
outputFormatoutput file format
outputExtentoutput extent. CRS for output is taken from first entry in rasterEntries.
nOutputColumnsnumber of columns in output raster
nOutputRowsnumber of rows in output raster
rasterEntrieslist of referenced raster layers

Definition at line 33 of file qgsrastercalculator.cpp.

◆ QgsRasterCalculator() [2/2]

QgsRasterCalculator::QgsRasterCalculator ( const QString &  formulaString,
const QString &  outputFile,
const QString &  outputFormat,
const QgsRectangle outputExtent,
const QgsCoordinateReferenceSystem outputCrs,
int  nOutputColumns,
int  nOutputRows,
const QVector< QgsRasterCalculatorEntry > &  rasterEntries 
)

QgsRasterCalculator constructor.

Parameters
formulaStringformula for raster calculation
outputFileoutput file path
outputFormatoutput file format
outputExtentoutput extent, CRS is specified by outputCrs parameter
outputCrsdestination CRS for output raster
nOutputColumnsnumber of columns in output raster
nOutputRowsnumber of rows in output raster
rasterEntrieslist of referenced raster layers
Since
QGIS 2.10

Definition at line 47 of file qgsrastercalculator.cpp.

Member Function Documentation

◆ processCalculation()

int QgsRasterCalculator::processCalculation ( QgsFeedback feedback = nullptr)

Starts the calculation and writes a new raster.

The optional feedback argument can be used for progress reporting and cancelation support.

Returns
0 in case of success

Definition at line 60 of file qgsrastercalculator.cpp.


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