Class: QgsRasterLayerUtils¶
Contains utility functions for working with raster layers.
Added in version 3.38.
- class qgis.core.QgsRasterLayerUtils[source]¶
Bases:
object- static alignRasterExtent(extent: QgsRectangle, origin: QgsPointXY, pixelSizeX: float, pixelSizeY: float) QgsRectangle[source]¶
Returns a new extent that includes the given
extentwith corners coordinates aligned to the pixel grid defined by theoriginandpixelSizeXandpixelSizeYarguments.The resulting extent will be expanded if necessary to ensure that its corners fall on pixel boundaries defined by the origin and pixel sizes.
- Return type:
- Returns:
The aligned extent or the original extent if pixel sizes are zero (to avoid division by zero) or if the extent is empty.
Added in version 4.0.
- Parameters:
extent (QgsRectangle)
origin (QgsPointXY)
pixelSizeX (float)
pixelSizeY (float)
- static renderedBandForElevationAndTemporalRange(layer: QgsRasterLayer | None, temporalRange: QgsDateTimeRange, elevationRange: QgsDoubleRange)[source]¶
Given a raster
layer, returns the band which should be used for rendering the layer for a specified temporal and elevation range, respecting any elevation and temporal settings which affect the rendered band.- Parameters:
layer (Optional[QgsRasterLayer]) – Target raster layer
temporalRange (QgsDateTimeRange) – temporal range for rendering
elevationRange (
QgsDoubleRange) -> (int) – elevation range for rendering
- Returns:
Matched band, or -1 if the layer does not have any elevation or temporal settings which affect the rendered band.
matched:
Trueif a band matching the temporal and elevation range was found