I have a distance raster map in tif format and I am trying to generate a binary raster where cells below 200m are asigned value 1 and cells above that value are 0. I've converted the distance raster to asc and checked that there are values under 200. I've written the following expression in the raster calculator: "disagua@1" <= 200 But the raster I get only displays 0s. I've tryied to reclass the distance raster using Saga reclass tools but I just get a raster with 0 values. However, If i try with values under 1000 I get a correct binary map. Could somebody please help me?

2 Answers 2


For the Raster Calculator, the logical equation is the first step needed in reclassifying a grid to identify which cells are being identified. The next step is assigning a new value to those cells (i.e. ("disagua@1" <= 200) * (new_value) + etc. ) Going through the steps visually is always better.

Elevation Grid

Starting with a typical grid (this one is SRTM elevation data in metres) open the Raster -> "Raster Calculator" from the drop down menu. (I've never had good results using SAGA's Raster Reclass tool available in the toolbox).

Raster Caulator

From there you can add as many equations as you'd like. The tool will say whether or not the equation is valid, and so long as you follow the syntax exampled here you should be fine.

Raster Reclass

The end result of the example equation shows a new grid with the new values for each grid category.


Thank you very much for your help. Finally I managed to solve the problem. I did not realize that when creating the legend of the raster latyer, extreme values were being cut and thus they were not represented. This is to say,in a binary raster where there are a lot of 0s and only a few 1s, the legend cuts the 1s and provides a raster layer where only 0s are visible. I think that the option "stretch to max min" should be used by default, it is more user friendly. Just for others who have the same problem; in order to avoid it go to the menu bar settings>options and then click on the left menu the option "rendering" you can change how the legends are displayed under the "raster" option. Select "stretch to min max" to ensure that the raster layer legends always display all values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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