Class: QgsPalettedRasterRenderer¶
-
class
qgis.core.
QgsPalettedRasterRenderer
(input: QgsRasterInterface, bandNumber: int, classes: Iterable[QgsPalettedRasterRenderer.Class])¶ Bases:
qgis._core.QgsRasterRenderer
Constructor for QgsPalettedRasterRenderer.
Renderer for paletted raster images.
Enums
Methods
Returns the raster band used for rendering the raster.
Opens a color table file and returns corresponding paletted renderer class data.
Generates class data from a
raster
, for the specifiedbandNumber
.Converts a
string
containing a color table or class data to to paletted renderer class data.Converts classes to a string representation, using the .clr/gdal color table file format.
Returns a map of value to classes (colors) used by the renderer.
QgsPalettedRasterRenderer cannot be copied.
Converts a raster color
table
to paletted renderer class data.Returns optional category label
Returns number of colors
Set category label
Set the source color
ramp
.Gets the source color ramp
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) → List[QgsPalettedRasterRenderer.Class]¶ Opens a color table file and returns corresponding paletted renderer class data.
See also
New in version 3.0.
-
classDataFromRaster
(raster: QgsRasterInterface, bandNumber: int, ramp: QgsColorRamp = None, feedback: QgsRasterBlockFeedback = None) → List[QgsPalettedRasterRenderer.Class]¶ Generates class data from a
raster
, for the specifiedbandNumber
. An optional colorramp
can be specified to automatically assign colors from the ramp.New in version 3.0.
-
classDataFromString
(string: str) → List[QgsPalettedRasterRenderer.Class]¶ Converts a
string
containing a color table or class data to to paletted renderer class data.See also
See also
New in version 3.0.
-
classDataToString
(classes: Iterable[QgsPalettedRasterRenderer.Class]) → str¶ Converts classes to a string representation, using the .clr/gdal color table file format.
See also
New in version 3.0.
-
classes
(self) → List[QgsPalettedRasterRenderer.Class]¶ 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]) → List[QgsPalettedRasterRenderer.Class]¶ 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.See also
New in version 3.0.
-
sourceColorRamp
(self) → QgsColorRamp¶ Gets the source color ramp
See also
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)¶
-
class