0

I'm trying to extract elevation data from a DEM file but I can't make it work.

I want to extract contour lines from a given area, and label those lines with the proper elevation value. The problem I'm facing right now is that I managed to extract the contours with the contour algorithm, but the elevation values are wrong.

The steps I follow are:

  1. Download the DEM file (.asc) and add it to my QGIS project.
  2. Run the contour algorithm on the DEM layer. Since I'm working with a 2x2 DEM file, I set the interval between lines to 2 (not sure if that's correct) and I also set the atribution name to "ELEV" (default)
  3. Label the output vector layer with the contours to show the "ELEV" values on each contour line.

Then, I used the "identify features" tool on the DEM layer, and clicked a random point that I knew the real elevation to check if the DEM had bad data, but it was correct. So no issues with my DEM.

On the other hand, the "ELEV" label value was not correct. I was getting an error of like ~80 units (the label value was 90 and the real value was ~170)

So there's something wrong with my procedure, but I don't know how to fix it.

Additional info:

  • SRC EPSG:25831 - ETRS89 / UTM zone 31N - Proyectado
  • Tipo de datos (data type) Float64 - Número de coma flotante de 64 bits
  • Banda 1 STATISTICS_MAXIMUM=322.522 STATISTICS_MEAN=171.58152588021 STATISTICS_MINIMUM=87.393 STATISTICS_STDDEV=43.912078992413 STATISTICS_VALID_PERCENT=100

I feel like the "Banda 1" data is the one that I need, and the one that shows when I click on a random point using the "identify features" tool.

3
  • 1
    I think you need to tell us a little more about the DEM you're using. In particular its origin and its CRS.
    – nhopton
    May 8, 2020 at 14:37
  • I got it from the national geographic institute of spain (IGN), and the CRS I'm working with is the EPSG:25831 - ETRS89 / UTM zone 31N @nhopton
    – Satcar
    May 8, 2020 at 14:43
  • 2
    Usually the interval between lines would be 10m or 50m depending on how high your hills are - it has nothing to do with the resolution of the DEM
    – Ian Turton
    May 8, 2020 at 16:12

1 Answer 1

1

Using the GDAL contour algorithm (under GDAL-> Raster extraction in the Processing Toolbox) should work.

  1. Choose the DEM as Input layer.
  2. Choose the Band number with the elevation values.
  3. Choose the Interval between contour lines (5 if you want a 5 meter contour interval).
  4. Set the Attribute name to elev or some other suitable name (must not be empty).
  5. Offset must be 0 if the DEM contains the real elevation values.

This works like a charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.