Class: QgsPalettedRasterRenderer¶
-
class
qgis.core.
QgsPalettedRasterRenderer
(input: QgsRasterInterface, bandNumber: int, classes: object)¶ Bases:
QgsRasterRenderer
Constructor for QgsPalettedRasterRenderer.
Renderer for paletted raster images.
- Parameters
input (QgsRasterInterface) –
bandNumber (int) –
classes –
-
class
Class
(value: int, color: Union[QColor, Qt.GlobalColor, QGradient] = QColor(), label: str = '')¶ Bases:
sip.wrapper
Constructor for Class
QgsPalettedRasterRenderer.Class(QgsPalettedRasterRenderer.Class)
- Parameters
value (int) –
color (Union[QColor) –
label (str = '') –
-
color
¶
-
label
¶
-
value
¶
-
band
(self) → int¶ Returns the raster band used for rendering the raster.
New in version 3.0.
- Return type
int
-
block
(self, bandNo: int, extent: QgsRectangle, width: int, height: int, feedback: QgsRasterBlockFeedback = None) → QgsRasterBlock¶ - Parameters
bandNo (int) –
extent (QgsRectangle) –
width (int) –
height (int) –
feedback (
QgsRasterBlockFeedback
= None) –
- Return type
-
classDataFromFile
(path: str) → object¶ Opens a color table file and returns corresponding paletted renderer class data.
See also
New in version 3.0.
- Parameters
path (str) –
- Return type
object
-
classDataFromRaster
(raster: QgsRasterInterface, bandNumber: int, ramp: QgsColorRamp = None, feedback: QgsRasterBlockFeedback = None) → object¶ 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.
- Parameters
raster (QgsRasterInterface) –
bandNumber (int) –
ramp (
QgsColorRamp
= None) –feedback (
QgsRasterBlockFeedback
= None) –
- Return type
object
-
classDataFromString
(string: str) → object¶ 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.
- Parameters
string (str) –
- Return type
object
-
classDataToString
(classes: object) → str¶ Converts classes to a string representation, using the .clr/gdal color table file format.
See also
New in version 3.0.
- Parameters
classes (object) –
- Return type
str
-
classes
(self) → object¶ Returns a map of value to classes (colors) used by the renderer.
- Return type
object
-
clone
(self) → QgsPalettedRasterRenderer¶ QgsPalettedRasterRenderer
cannot be copied. Use clone() instead.- Return type
-
colorTableToClassData
(table: Iterable[QgsColorRampShader.ColorRampItem]) → object¶ Converts a raster color
table
to paletted renderer class data.New in version 3.0.
- Parameters
table (Iterable[QgsColorRampShader.ColorRampItem]) –
- Return type
object
-
create
(elem: QDomElement, input: QgsRasterInterface) → QgsRasterRenderer¶ - Parameters
elem (QDomElement) –
input (QgsRasterInterface) –
- Return type
-
initHistogram
()¶
-
initStatistics
()¶
-
label
(self, idx: int) → str¶ Returns optional category label
New in version 2.1.
- Parameters
idx (int) –
- Return type
str
-
legendSymbologyItems
(self) → List[Tuple[str, QColor]]¶ - Return type
List[Tuple[str, QColor]]
-
nColors
(self) → int¶ Returns number of colors
- Return type
int
-
setLabel
(self, idx: int, label: str)¶ Set category label
New in version 2.1.
- Parameters
idx (int) –
label (str) –
-
setSourceColorRamp
(self, ramp: QgsColorRamp)¶ Set the source color
ramp
. Ownership is transferred to the renderer.See also
New in version 3.0.
- Parameters
ramp (QgsColorRamp) –
-
sourceColorRamp
(self) → QgsColorRamp¶ Gets the source color ramp
See also
New in version 3.0.
- Return type
-
toSld
(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})¶ - 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) –