Class: QgsPalettedRasterRenderer

class qgis.core.QgsPalettedRasterRenderer(input: QgsRasterInterface, bandNumber: int, classes: object)

Bases: qgis._core.QgsRasterRenderer

Constructor for QgsPalettedRasterRenderer.

Renderer for paletted raster images.

Enums

Methods

band Returns the raster band used for rendering the raster.
block
classDataFromFile Opens a color table file and returns corresponding paletted renderer class data.
classDataFromRaster Generates class data from a raster, for the specified bandNumber.
classDataFromString Converts a string containing a color table or class data to to paletted renderer class data.
classDataToString Converts classes to a string representation, using the .clr/gdal color table file format.
classes Returns a map of value to classes (colors) used by the renderer.
clone QgsPalettedRasterRenderer cannot be copied.
colorTableToClassData Converts a raster color table to paletted renderer class data.
create
initHistogram
initStatistics
label Returns optional category label
legendSymbologyItems
nColors Returns number of colors
setLabel Set category label
setSourceColorRamp Set the source color ramp.
sourceColorRamp Gets the source color ramp
toSld
usesBands
writeXml

Signals

Attributes

class Class(value: int, color: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), label: str = '')

Bases: sip.wrapper

Constructor for Class

QgsPalettedRasterRenderer.Class(QgsPalettedRasterRenderer.Class)

color
label
value
band(self) → int

Returns the raster band used for rendering the raster.

New in version 3.0.

block(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) → QgsRasterBlock
classDataFromFile(path: str) → object

Opens a color table file and returns corresponding paletted renderer class data.

New in version 3.0.

classDataFromRaster(raster: QgsRasterInterface, bandNumber: int, ramp: QgsColorRamp = None, feedback: QgsRasterBlockFeedback = None) → object

Generates class data from a raster, for the specified bandNumber. An optional color ramp can be specified to automatically assign colors from the ramp.

New in version 3.0.

classDataFromString(string: str) → object

Converts a string containing a color table or class data to to paletted renderer class data.

New in version 3.0.

classDataToString(classes: object) → str

Converts classes to a string representation, using the .clr/gdal color table file format.

New in version 3.0.

classes(self) → object

Returns a map of value to classes (colors) used by the renderer.

clone(self) → QgsPalettedRasterRenderer

QgsPalettedRasterRenderer cannot be copied. Use clone() instead.

colorTableToClassData(table: Iterable[QgsColorRampShader.ColorRampItem]) → object

Converts a raster color table to paletted renderer class data.

New in version 3.0.

create(elem: QDomElement, input: QgsRasterInterface) → QgsRasterRenderer
initHistogram()
initStatistics()
label(self, idx: int) → str

Returns optional category label

New in version 2.1.

legendSymbologyItems(self) → List[Tuple[str, QColor]]
nColors(self) → int

Returns number of colors

setLabel(self, idx: int, label: str)

Set category label

New in version 2.1.

setSourceColorRamp(self, ramp: QgsColorRamp)

Set the source color ramp. Ownership is transferred to the renderer.

New in version 3.0.

sourceColorRamp(self) → QgsColorRamp

Gets the source color ramp

New in version 3.0.

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})
usesBands(self) → List[int]
writeXml(self, doc: QDomDocument, parentElem: QDomElement)