0

I'm trying to extract the total area within the same altitude range in a DEM. As example, I'd like to know the total area between 800-900 m asl of a DEM. Using r.report I've just got this:

enter image description here

How can I set up the range values instead of a 'random' ranges generated by the gis tool?

I'd like to use this in the same way to calculate slope ranges etc.

1
  • 1
    ArcGIS has reclassify tool you can choose equal interval and specify how many intervals you would like. Then you can calculate the areas from pixel counts.
    – Amadeus
    Commented Oct 21, 2017 at 4:58

2 Answers 2

2

Just to complete the answers already suggested, the easiest way to do this is with a combination of r.reclass and r.stats. Set up a text file with the value ranges you want. Run r.reclass on the original DEM to create a reclassed raster. (The advantage here is that the reclass raster is not a new map, just a definition of category values, so it saves space).

Now do r.stats -a on the reclass raster. This will output the area for each category value.

1

The ranges aren't random. I think the default is to set up 255 equal-interval buckets (steps) between the min and max values.

This seems an odd choice, but it is a sensible default for common uses of this tool, for example land cover classifications.

I can't test this at the moment, but i would try the following:-

Use r.mapcalc with a formula like this, replacing 'mylayer' with your layer name. Use this to create a new raster.

int(mylayer/100)*100.0

that will mean range [0, 99.99] maps to 0.0, [100.0-199.9] to 100.0 and so on.

Run r.report like you did before. Set the number of buckets using the nsteps parameter. For example, if your lowest rounded elevation is 300 and maximum is 700, use 4 bands. Manual page

If using QGIS both of these should be available in Processing

Because your min and max values are now multiples of 100, you can use a fixed number of bands. All cells between 800.0 and 899.99 should go in the same band.

There is the r.reclassify method, see this answer for more info. That needs a text file set up, though, and I think it only works with integers. But it might be better if you want uneven sized ranges.

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.