[GIS] Using raster calculator in the graphical modeler of QGIS

qgisqgis-modelerraster-calculator

enter image description hereI have a raster with slope values and want to calculate a raster, which only shows values under and over a certain threshold for example 50. In the raster calculator I can do this manually by the expression

"Slope@1" >= 50

As I want to do this for several rasters and it is only one step in a chain, I would like to include it as a step in the graphical modeller of QGIS.This provides the GDAL Raster Calculator, the modeler only tool Calculator and the Saga Raster Calculator, but in none of these I can find out, what to type in to get the desired result.

Best Answer

If you choose "GDAL Raster calculator", Input layer A would be Slope (though grayed out in modeller), Number of raster band= 1, and the Calculation in gdalnumeric syntax using... would be A*(A>=50).

Of A*(A>=50) the latter part (A>=50) returns 1 (TRUE) or 0 (FALSE). So the resultant equation A times 1 or 0 (A*1, A*0) is equivalent to setting a threshold value.

Related Question