Helpers for the Python console

helpers.RasterWizard helps to get the data of a QGIS raster layer as a numpy array, and the processing result back into QGIS as a new raster layer.

helpers.RasterWindow can be used to process large rasters in a moving window.

More helpers

helpers.rasterhash(rlayer=None)[source]

Return a SHA224 hash of the raster data

For unit testing. Getting the hash of a layer quickly helps to write unit tests faster. Can be used to compare raster data between runs of the same algorithm. It is calucated in the same way as in QGIS core TestTools.py, but more convienient to use e.g. in the console. Parameter rlayer is a QGIS raster layer or a file path to a raster file. Default is the active layer.

Parameters

rlayer (QgsRasterLayer or str, optional) – raster layer or file path, default is active layer.

Returns

SHA224 hash of the raster data

Return type

str