# How to calculate te area between contour lines on a DEM with QGIS 1.8?

Does anyone know how to calculate the area in km² for each altitudinal band (between 100 and 200, 200 and 300...) based on a DEM? I added the contour lines with a distance of 100 metres but could not find a way to modify them in order to allow area calculation. I am working with qgis 1.8.0. DEM is taken from ASTER.

-
If you have the original DEM, just reclassify it into the contour intervals and multiply the class counts by the cell area. – whuber Dec 18 '12 at 15:04

My initial answer was wrong so im providing a new one:

As wuber said the best way to calculate the area to reclassify the parts of your dem you want measure, polygonize (raster to vector) then add the \$area attribute. Here's a step-by-step example.

For the purpose of this example im using a DEM which can be downloaded from here.

1. Open your DEM with QGIS. For the example DEM the upper and lower limits are approximately from elevation 3300 to 3550 m.
2. You want measure the area which is between eg. 3400 and 3500.
3. First you need to mark those area. You can use the Raster Calculator from the Raster menu.
4. At the Raster Calculator use the following formula : (O44121a1@1 >= 3400 and O44121a1@1 <= 3500) . This will create a mask marking with 1 all the areas we're interested in.
5. From Raster menu again, Select the Conversion->Polygonize tool. Select the Raster map you created in step 4 as input and also tick the Field Name option. You can use whatever name you want.
6. We only want two polygons. One polygon to mark the ares we are intrested in at the other to mark the polygons we are not intrested in. To group all the polygons to those two categories from Vector menu, choose Geometry Tools -> Singleparts to Multiparts Tool. Choose the polygon you created at step 5, and use the Field Name you chose.
7. Open the attribute table of the shapefile you created in step 6, and click at the field calculator button (you need to be in edit mode first). choose to create a new column define the precision , and in the expression box bellow type \$area (or you can double click it from the list), and click OK.
8. The new field should contain the area in MapUnits² with the choosen presision.
-
Thank you! Steps 1 to 6 are working well. I have some problems with the field calculator: Whatever I insert, the result is always the same. If I want to close edit mode, it turns to 0. I could not find this problem so I guess something is wrong with my general settings. Any ideas? – Sebastian Dec 21 '12 at 11:03
What projection are you using? What are its units? If it is degrees the \$area won't work. – HeyOverThere Jan 3 '13 at 18:58
Ok, that was one problem, thank you. The project CRS now is WGS 84 / UTM zone 46N. That schould be metres, right? If yes, I'll get my km² by dividing the result by 1000? – Sebastian Jan 3 '13 at 20:49
From m² to km² it should be divided by 1000000. – AndreJ Apr 8 '13 at 18:27