Class: QgsSingleBandPseudoColorRenderer

class qgis.core.QgsSingleBandPseudoColorRenderer

Bases: QgsRasterRenderer

Raster renderer pipe for single band pseudocolor.

QgsSingleBandPseudoColorRenderer(input: QgsRasterInterface, band: int = -1, shader: QgsRasterShader = None) Note: takes ownership of QgsRasterShader

Methods

accept

param visitor

band

Returns the band used by the renderer

block

param bandNo

classificationMax

rtype

float

classificationMin

rtype

float

clone

QgsSingleBandPseudoColorRenderer cannot be copied.

constShader

create

param elem

createLegendNodes

param nodeLayer

createShader

Creates a color ramp shader

initHistogram

Fill in histogram defaults if not specified

initStatistics

Fill in statistics defaults if not specified

legendSymbologyItems

rtype

List[Tuple[str, QColor]]

renderColorForNodataPixel

Returns the color for the renderer to use to represent nodata pixels.

setBand

Sets the band used by the renderer.

setClassificationMax

param max

setClassificationMin

param min

setShader

Takes ownership of the shader

shader

Returns the raster shader

toSld

param doc

usesBands

rtype

List[int]

writeXml

param doc

accept(self, visitor: QgsStyleEntityVisitorInterface) bool
Parameters

visitor (QgsStyleEntityVisitorInterface) –

Return type

bool

band(self) int

Returns the band used by the renderer

New in version 2.7.

Return type

int

block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) QgsRasterBlock
Parameters
Return type

QgsRasterBlock

classificationMax(self) float
Return type

float

classificationMin(self) float
Return type

float

clone(self) QgsSingleBandPseudoColorRenderer

QgsSingleBandPseudoColorRenderer cannot be copied. Use clone() instead.

Return type

QgsSingleBandPseudoColorRenderer

constShader(self) QgsRasterShader

Note

available in Python as constShader

Return type

QgsRasterShader

create(elem: QDomElement, input: QgsRasterInterface) QgsRasterRenderer
Parameters
Return type

QgsRasterRenderer

createLegendNodes(self, nodeLayer: QgsLayerTreeLayer) List[QgsLayerTreeModelLegendNode]
Parameters

nodeLayer (QgsLayerTreeLayer) –

Return type

List[QgsLayerTreeModelLegendNode]

createShader(self, colorRamp: QgsColorRamp = None, colorRampType: QgsColorRampShader.Type = QgsColorRampShader.Interpolated, classificationMode: QgsColorRampShader.ClassificationMode = QgsColorRampShader.Continuous, classes: int = 0, clip: bool = False, extent: QgsRectangle = QgsRectangle())

Creates a color ramp shader

Parameters
  • colorRamp (QgsColorRamp = None) – vector color ramp. Ownership is transferred to the shader.

  • colorRampType (QgsColorRampShader.Type = QgsColorRampShader.Interpolated) – type of color ramp shader

  • classificationMode (QgsColorRampShader.ClassificationMode = QgsColorRampShader.Continuous) – classification mode

  • classes (int = 0) – number of classes

  • clip (bool = False) – clip out of range values

  • extent (QgsRectangle = QgsRectangle()) – extent used in classification (only used in quantile mode)

initHistogram(self, histogram: QgsRasterHistogram, bandNo: int, binCount: int, minimum: object = Py_None, maximum: object = Py_None, boundingBox: QgsRectangle = QgsRectangle(), sampleSize: int = 0, includeOutOfRange: bool = False)

Fill in histogram defaults if not specified

Note

the parameters are the same as in histogram()

initStatistics(self, statistics: QgsRasterBandStats, bandNo: int, stats: int = QgsRasterBandStats.All, boundingBox: QgsRectangle = QgsRectangle(), binCount: int = 0)

Fill in statistics defaults if not specified

legendSymbologyItems(self) List[Tuple[str, QColor]]
Return type

List[Tuple[str, QColor]]

renderColorForNodataPixel(self) int

Returns the color for the renderer to use to represent nodata pixels.

Subclasses should use this rather then nodataColor() to determine the color to use for nodata pixels during an actual rendering operation.

New in version 3.10.

setBand(self, bandNo: int)

Sets the band used by the renderer.

See also

band()

New in version 2.10.

Parameters

bandNo (int) –

setClassificationMax(self, max: float)
Parameters

max (float) –

setClassificationMin(self, min: float)
Parameters

min (float) –

setShader(self, shader: QgsRasterShader)

Takes ownership of the shader

Parameters

shader (QgsRasterShader) –

shader(self) QgsRasterShader

Returns the raster shader

Return type

QgsRasterShader

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, Any] = {})
Parameters
  • doc (QDomDocument) –

  • element (QDomElement) –

  • props (Dict[str) –

usesBands(self) List[int]
Return type

List[int]

writeXml(self, doc: QDomDocument, parentElem: QDomElement)
Parameters
  • doc (QDomDocument) –

  • parentElem (QDomElement) –