Class: QgsHillshadeRenderer

A renderer for generating live hillshade models.

Class Hierarchy

Inheritance diagram of qgis.core.QgsHillshadeRenderer

Base classes

QgsRasterRenderer

Raster renderer pipe that applies colors to a raster.

QgsRasterInterface

Base class for processing filters like renderers, reprojector, resampler etc.

Methods

altitude

Returns the angle of the light source over the raster.

azimuth

Returns the direction of the light over the raster between 0-360.

band

Returns the band used by the renderer

multiDirectional

Returns True if the renderer is using multi-directional hillshading.

setAltitude

Set the altitude of the light source

setAzimuth

Set the azimuth of the light source.

setBand

Sets the band used by the renderer.

setMultiDirectional

Sets whether to render using a multi-directional hillshade algorithm.

setZFactor

Set the Z scaling factor of the result image.

zFactor

Returns the Z scaling factor.

Static Methods

create

Factory method to create a new renderer

class qgis.core.QgsHillshadeRenderer[source]

Bases: QgsRasterRenderer

__init__(input: QgsRasterInterface | None, band: int, lightAzimuth: float, lightAltitude: float)

A renderer for generating live hillshade models.

Parameters:
  • input (Optional[QgsRasterInterface]) – The input raster interface

  • band (int) – The band in the raster to use

  • lightAzimuth (float) – The azimuth of the light source

  • lightAltitude (float) – The altitude of the light source

altitude(self) float[source]

Returns the angle of the light source over the raster.

See also

setAltitude()

Return type:

float

azimuth(self) float[source]

Returns the direction of the light over the raster between 0-360.

See also

setAzimuth()

Return type:

float

band(self) int[source]

Returns the band used by the renderer

Deprecated since version 3.38: Use inputBand() instead.

Return type:

int

static create(elem: QDomElement, input: QgsRasterInterface | None) QgsRasterRenderer | None[source]

Factory method to create a new renderer

Parameters:
  • elem (QDomElement) – A DOM element to create the renderer from.

  • input (Optional[QgsRasterInterface]) – The raster input interface.

Return type:

Optional[QgsRasterRenderer]

Returns:

A new QgsHillshadeRenderer.

multiDirectional(self) bool[source]

Returns True if the renderer is using multi-directional hillshading.

Return type:

bool

setAltitude(self, altitude: float)[source]

Set the altitude of the light source

Parameters:

altitude (float) – the altitude

See also

altitude()

setAzimuth(self, azimuth: float)[source]

Set the azimuth of the light source.

Parameters:

azimuth (float) – The azimuth of the light source, between 0 and 360.0

See also

azimuth()

setBand(self, bandNo: int)[source]

Sets the band used by the renderer.

See also

band()

Deprecated since version 3.38: Use setInputBand() instead.

Parameters:

bandNo (int)

setMultiDirectional(self, isMultiDirectional: bool)[source]

Sets whether to render using a multi-directional hillshade algorithm.

Parameters:

isMultiDirectional (bool) – set to True to use multi directional rendering

setZFactor(self, zfactor: float)[source]

Set the Z scaling factor of the result image.

Parameters:

zfactor (float) – The z factor

See also

zFactor()

zFactor(self) float[source]

Returns the Z scaling factor.

See also

setZFactor()

Return type:

float