QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsRasterCalculator Class Reference

Performs raster layer calculations. More...

#include <qgsrastercalculator.h>

Public Types

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

Public Member Functions

Q_DECL_DEPRECATED 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.
 
 QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, const QgsCoordinateReferenceSystem &outputCrs, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries, const QgsCoordinateTransformContext &transformContext)
 QgsRasterCalculator constructor.
 
Q_DECL_DEPRECATED QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries)
 QgsRasterCalculator constructor.
 
 QgsRasterCalculator (const QString &formulaString, const QString &outputFile, const QString &outputFormat, const QgsRectangle &outputExtent, int nOutputColumns, int nOutputRows, const QVector< QgsRasterCalculatorEntry > &rasterEntries, const QgsCoordinateTransformContext &transformContext)
 QgsRasterCalculator constructor.
 
QString lastError () const
 Returns a description of the last error encountered.
 
Result processCalculation (QgsFeedback *feedback=nullptr)
 Starts the calculation and writes a new raster.
 

Detailed Description

Performs raster layer calculations.

Definition at line 76 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.

BandError 

Invalid band number for input.

CalculationError 

Error occurred while performing calculation.

Definition at line 81 of file qgsrastercalculator.h.

Constructor & Destructor Documentation

◆ QgsRasterCalculator() [1/4]

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

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
transformContextcoordinate transformation context
Since
QGIS 3.8

Definition at line 74 of file qgsrastercalculator.cpp.

◆ QgsRasterCalculator() [2/4]

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,
const QgsCoordinateTransformContext transformContext 
)

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
transformContextcoordinate transformation context
Since
QGIS 3.8

Definition at line 87 of file qgsrastercalculator.cpp.

◆ QgsRasterCalculator() [3/4]

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
Deprecated:
QGIS 3.8. Use the version with transformContext instead.

Definition at line 104 of file qgsrastercalculator.cpp.

◆ QgsRasterCalculator() [4/4]

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
Deprecated:
QGIS 3.8. Use the version with transformContext instead.

Definition at line 121 of file qgsrastercalculator.cpp.

Member Function Documentation

◆ lastError()

QString QgsRasterCalculator::lastError ( ) const

Returns a description of the last error encountered.

Since
QGIS 3.4

Definition at line 735 of file qgsrastercalculator.cpp.

◆ processCalculation()

QgsRasterCalculator::Result QgsRasterCalculator::processCalculation ( QgsFeedback feedback = nullptr)

Starts the calculation and writes a new raster.

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

Returns
QgsRasterCalculator::Success in case of success. If an error is encountered then a description of the error can be obtained by calling lastError().

Definition at line 135 of file qgsrastercalculator.cpp.


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