I am trying to use raster calculator to extract values from a GeoTIFF file showing rainfall. I would like to generate a raster with the range of 90-110 mm only see expression ("wc2.1_30s_bio_17@1" >= 90 <= 110).

However, when I carry out the processing, the new output raster only shows 0-1 values.

1 Answer 1


When an expression is True in raster calculator, 1 is returned, if it is False 0 is returned. So if you want the Trues to keep their values from your raster you should multiply by it.

I keep the values in the range 300 to 400, else I set them to 0.

(("nh_68_5@1">300) AND ("nh_68_5@1"<400)) * "nh_68_5@1" +
("nh_68_5@1"<=300)*0 + 

I've colored the zeros purple in styling: enter image description here


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.