Class: QgsRasterCalcNode

Represents a node in a raster calculator.

Methods

cleanRasterReferences

Returns a list of raster layer references that are addressed in the formula, without quotation marks.

findNodes

Returns a list of nodes of a specific type

referencedLayerNames

Returns a list of raster layer names that are referenced in the formula without the quotation marks.

setLeft

setRight

toString

Returns a string representation of the expression

type

Static Methods

parseRasterCalcString

Attributes

opABS

opACOS

opAND

opASIN

opATAN

opCOS

opDIV

opEQ

opGE

opGT

opLE

opLOG

opLOG10

opLT

opMAX

opMIN

opMINUS

opMUL

opNE

opNONE

opOR

opPLUS

opPOW

opSIGN

opSIN

opSQRT

opTAN

tFunction

tMatrix

tNumber

tOperator

tRasterRef

class qgis.analysis.QgsRasterCalcNode[source]

Bases: object

__init__()
__init__(number: float)
Parameters:

number (float)

__init__(matrix: QgsRasterMatrix | None)
Parameters:

matrix (Optional[QgsRasterMatrix])

__init__(op: QgsRasterCalcNode.Operator, left: QgsRasterCalcNode | None, right: QgsRasterCalcNode | None)
Parameters:
__init__(functionName: str | None, functionArgs: Iterable[QgsRasterCalcNode])

Constructor for the tFunction type

Parameters:
__init__(rasterName: str | None)
Parameters:

rasterName (Optional[str])

class Operator

Bases: int

class Type

Bases: int

cleanRasterReferences(self) List[str][source]

Returns a list of raster layer references that are addressed in the formula, without quotation marks.

Note

since QGIS 3.22

Return type:

List[str]

findNodes(self, type: QgsRasterCalcNode.Type) List[QgsRasterCalcNode]

Returns a list of nodes of a specific type

Added in version 3.6.

Parameters:

type (QgsRasterCalcNode.Type)

Return type:

List[QgsRasterCalcNode]

opABS = 23
opACOS = 10
opAND = 18
opASIN = 9
opATAN = 11
opCOS = 7
opDIV = 3
opEQ = 12
opGE = 16
opGT = 14
opLE = 17
opLOG = 21
opLOG10 = 22
opLT = 15
opMAX = 24
opMIN = 25
opMINUS = 1
opMUL = 2
opNE = 13
opNONE = 26
opOR = 19
opPLUS = 0
opPOW = 4
opSIGN = 20
opSIN = 6
opSQRT = 5
opTAN = 8
static parseRasterCalcString(str: str | None, parserErrorMsg: str | None) QgsRasterCalcNode | None[source]
Parameters:
  • str (Optional[str])

  • parserErrorMsg (Optional[str])

Return type:

Optional[QgsRasterCalcNode]

referencedLayerNames(self) List[str][source]

Returns a list of raster layer names that are referenced in the formula without the quotation marks. It uses QgsRasterCalcNode.cleanRasterReferences

Note

since QGIS 3.22

Return type:

List[str]

setLeft(self, left: QgsRasterCalcNode | None)[source]
Parameters:

left (Optional[QgsRasterCalcNode])

setRight(self, right: QgsRasterCalcNode | None)[source]
Parameters:

right (Optional[QgsRasterCalcNode])

tFunction = 5
tMatrix = 4
tNumber = 2
tOperator = 1
tRasterRef = 3
toString(self, cStyle: bool = False) str[source]

Returns a string representation of the expression

Parameters:

cStyle (bool = False) – if True operators will follow C syntax

Added in version 3.6.

Return type:

str

type(self) QgsRasterCalcNode.Type[source]
Return type:

QgsRasterCalcNode.Type