The Raster Calculator in QGIS allows you to run any expression on a raster or collection of rasters. While it is definitely useful, exactly how to phrase your expression in order to reclassify a raster is not always clear. Let’s say you have a raster with values between 0 and 255, and you want everything between 100 and 150 set to 1 (and the rest to 0). If you’re like me, your first instinct would be to write an expression that looks somewhat like this:
((raster@1 > 100) AND (raster@1 < 150)) = 1 else = 0
However, this does not work. In fact, in my case it returned the opposite of what I wanted (and without the “else …”, it returned nothing at all). Instead, the proper way to do it turns out to be this:
((raster@1 < 100) OR (raster@1 > 150)) = 0
Whatever is not set to zero by this statement will be set to 1 instead.