Class: QgsRasterRenderer

class qgis.core.QgsRasterRenderer(input: QgsRasterInterface = None, type: str = '')

Bases: qgis._core.QgsRasterInterface

Constructor for QgsRasterRenderer.

Raster renderer pipe that applies colors to a raster.

Enums

Methods

accept

Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer.

alphaBand

bandCount

block

clone

QgsRasterRenderer cannot be copied.

copyCommonProperties

Copies common properties like opacity / transparency data from other renderer.

dataType

initHistogram

initStatistics

legendSymbologyItems

Gets symbology items if provided by renderer

minMaxOrigin

Returns const reference to origin of min/max values

opacity

Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque).

rasterTransparency

readXml

Sets base class members from xml.

setAlphaBand

setInput

setMinMaxOrigin

Sets origin of min/max values

setOpacity

Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque).

setRasterTransparency

toSld

Used from subclasses to create SLD Rule elements following SLD v1.0 specs

type

usesBands

Returns a list of band numbers used by the renderer

usesTransparency

Signals

Attributes

NODATA_COLOR

NODATA_COLOR = 0
accept(self, visitor: QgsStyleEntityVisitorInterface) → bool

Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer.

Returns True if the visitor should continue visiting other objects, or False if visiting should be canceled.

New in version 3.10.

alphaBand(self) → int
bandCount(self) → int
block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) → QgsRasterBlock
clone(self) → QgsRasterRenderer

QgsRasterRenderer cannot be copied. Use clone() instead.

copyCommonProperties(self, other: QgsRasterRenderer, copyMinMaxOrigin: bool = True)

Copies common properties like opacity / transparency data from other renderer. Useful when cloning renderers.

New in version 2.16.

dataType(self, bandNo: int) → Qgis.DataType
initHistogram()
initStatistics()
legendSymbologyItems(self) → List[Tuple[str, QColor]]

Gets symbology items if provided by renderer

minMaxOrigin(self) → QgsRasterMinMaxOrigin

Returns const reference to origin of min/max values

opacity(self) → float

Returns the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque).

See also

setOpacity()

rasterTransparency(self) → QgsRasterTransparency
readXml(self, rendererElem: QDomElement)

Sets base class members from xml. Usually called from create() methods of subclasses

setAlphaBand(self, band: int)
setInput(self, input: QgsRasterInterface) → bool
setMinMaxOrigin(self, origin: QgsRasterMinMaxOrigin)

Sets origin of min/max values

setOpacity(self, opacity: float)

Sets the opacity for the renderer, where opacity is a value between 0 (totally transparent) and 1.0 (fully opaque).

See also

opacity()

setRasterTransparency(self, t: QgsRasterTransparency)
toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})

Used from subclasses to create SLD Rule elements following SLD v1.0 specs

New in version 3.6.

type(self) → str
usesBands(self) → List[int]

Returns a list of band numbers used by the renderer

usesTransparency(self) → bool