1

I'm trying make a raster of the area between 5 and 10 thousand feet in Colorado. I have DEMs, and I'd like to make a raster where all the area in this range is a value of 1, and the area outside the range (<5000 or >10,000) is 0. I tried (lower value < "raster-name" < upper value) in raster calculator, but this did not work (it made files with no data- I have a post about this too, but at this point I think it'd be more helpful to just start over and try a different way)

How should I approach this? And if there's a way I can avoid analyzing the ~60 DEMs one at a time, that would be even better

This isn't answered by a similar post because they wanted one 'less than' bound and a 'does not equal a value' (they wanted less than or equal to 15 and doesn't equal 0). I'm looking for something that works with an upper AND a lower bound

  • You could use the reclassify tool available in GRASS. See this link: gis.stackexchange.com/questions/17712/… – GBG Apr 1 '18 at 4:20
  • I think this is what I want – Shane Apr 1 '18 at 5:37
  • 1
    Do you know of a tutorial or comprehensive guide to r.rclass anywhere? The GRASS help is pretty vague and glosses over the things I don't understand (how specifically to create the rules file, and the specifics of selecting the input file). The online tutorials say you can enter the rules right into the r.reclass dialog, which in my version I cannot, unless I'm missing something – Shane Apr 1 '18 at 5:39
  • Or would it be better to ask this in a separate question? – Shane Apr 1 '18 at 5:39
1

Raster calculator (from menu Raster | Raster calculator) is a good tool. The expression to extract elevation between 5,000 and 10,000 ft is:

("YourRaster@1" >= 5000) AND ("YourRaster@1" <= 10000)

It will look like below:

enter image description here


Additional note: - not mandatory

After conversion (to 0 and 1), you may want to change the bit depth of your raster to integer (since the default output of Raster Calculator is 32-bit float value).

In the processing toolbox, you have a SAGA Change data storage tool to convert raster bit depth.

enter image description here

Unsigned 1 byte integer will give you a raster with 1-byte (8-bit) integer (0, 1) value.

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.