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.

  • Could be that you need quotes around the band definition and the whole input. Like ""Slope@1>=50"
    – Matte
    Commented Feb 14, 2017 at 13:56

1 Answer 1


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.

  • Actually this seems like what I am looking for. However when I execute it like you proposed, I get the raster layer in the middle as a result (first image is the raster with the slope values), instead of the expected lower raster image.
    – Moo
    Commented Feb 14, 2017 at 18:00
  • @Moo I am not sure but it seems you are trying to achieve a binary (1, 0) image. Then the equation would be (A>=50) or (A<50) depending on to which color each 1 and 0 is assigned.
    – Kazuhito
    Commented Feb 14, 2017 at 23:27
  • That is the solution I searched for: I simply did not add the braces.
    – Moo
    Commented Feb 19, 2017 at 22:45
  • @Moo I am glad it worked out. Sorry the braces (I tried to highlight them) were misleading.
    – Kazuhito
    Commented Feb 19, 2017 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.