Class: QgsHillshadeRenderer¶
- class qgis.core.QgsHillshadeRenderer¶
Bases:
QgsRasterRenderer
A renderer for generating live hillshade models.
New in version 2.16.
QgsHillshadeRenderer(input:
QgsRasterInterface
, band: int, lightAzimuth: float, lightAltitude: float) A renderer for generating live hillshade models.- Parameters
input – The input raster interface
band – The band in the raster to use
lightAzimuth – The azimuth of the light source
lightAltitude –
The altitude of the light source
Methods
Returns the angle of the light source over the raster.
Returns the direction of the light over the raster between 0-360.
Returns the band used by the renderer
- param bandNo
- rtype
QgsHillshadeRenderer
Factory method to create a new renderer
Fill in histogram defaults if not specified
Fill in statistics defaults if not specified
Returns
True
if the renderer is using multi-directional hillshading.Returns the color for the renderer to use to represent nodata pixels.
Set the altitude of the light source
Set the azimuth of the light source.
Sets the band used by the renderer.
Sets whether to render using a multi-directional hillshade algorithm.
Set the Z scaling factor of the result image.
- param doc
- rtype
List[int]
- param doc
Returns the Z scaling factor.
- altitude(self) float ¶
Returns the angle of the light source over the raster.
See also
- Return type
float
- azimuth(self) float ¶
Returns the direction of the light over the raster between 0-360.
See also
- Return type
float
- band(self) int ¶
Returns the band used by the renderer
- 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
- clone(self) QgsHillshadeRenderer ¶
- Return type
- create(elem: QDomElement, input: QgsRasterInterface) QgsRasterRenderer ¶
Factory method to create a new renderer
- Parameters
elem (QDomElement) – A DOM element to create the renderer from.
input (QgsRasterInterface) – The raster input interface.
- Return type
- Returns
A new QgsHillshadeRenderer.
- 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
- multiDirectional(self) bool ¶
Returns
True
if the renderer is using multi-directional hillshading.See also
- Return type
bool
- 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.
- setAltitude(self, altitude: float)¶
Set the altitude of the light source
- Parameters
altitude (float) – the altitude
See also
- setAzimuth(self, azimuth: float)¶
Set the azimuth of the light source.
- Parameters
azimuth (float) – The azimuth of the light source, between 0 and 360.0
See also
- setBand(self, bandNo: int)¶
Sets the band used by the renderer.
See also
- Parameters
bandNo (int) –
- setMultiDirectional(self, isMultiDirectional: bool)¶
Sets whether to render using a multi-directional hillshade algorithm.
- Parameters
isMultiDirectional (bool) – set to
True
to use multi directional rendering
See also
- setZFactor(self, zfactor: float)¶
Set the Z scaling factor of the result image.
- Parameters
zfactor (float) – The z factor
See also
- 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) –
- zFactor(self) float ¶
Returns the Z scaling factor.
See also
- Return type
float