How to extract some values (eg: 2,7,42,132) from a raster and form a new raster file?

I need a file with specified values as 1 and the rest 0.


You could use something like the following in the Raster Calculator:

("raster@1" = 2) + ("raster@1" = 7) + ("raster@1" = 42) + ("raster@1" = 132)
  • 1
    this works, gives raster values of output 1(selected values) or 0(other). You can then change the symbology and transparency adding "0" to Additional no data values so they don't show if you want. – Louis May 5 '17 at 14:37

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.