Class: QgsRasterCalcNode

class qgis.analysis.QgsRasterCalcNode

Bases: sip.wrapper

Represents a node in a raster calculator.

QgsRasterCalcNode() Constructor for QgsRasterCalcNode.

QgsRasterCalcNode(number: float)

QgsRasterCalcNode(matrix: Optional[QgsRasterMatrix])

QgsRasterCalcNode(op: QgsRasterCalcNode.Operator, left: Optional[QgsRasterCalcNode], right: Optional[QgsRasterCalcNode])

QgsRasterCalcNode(functionName: Optional[str], functionArgs: Iterable[QgsRasterCalcNode]) Constructor for the tFunction type

QgsRasterCalcNode(rasterName: Optional[str])

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

parseRasterCalcString

param str:

referencedLayerNames

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

setLeft

param left:

setRight

param right:

toString

Returns a string representation of the expression

type

QgsRasterCalcNode cannot be copied

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 Operator

Bases: int

class Type

Bases: int

cleanRasterReferences(self) List[str]

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
parseRasterCalcString(str: str | None, parserErrorMsg: str | None) QgsRasterCalcNode | None
Parameters:
  • str (Optional[str])

  • parserErrorMsg (Optional[str])

Return type:

Optional[QgsRasterCalcNode]

referencedLayerNames(self) List[str]

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)
Parameters:

left (Optional[QgsRasterCalcNode])

setRight(self, right: QgsRasterCalcNode | None)
Parameters:

right (Optional[QgsRasterCalcNode])

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

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

QgsRasterCalcNode cannot be copied

Return type:

QgsRasterCalcNode.Type