0

I have a digital elevation model (DEM - geoTIFF) in QGIS 3.2. There is a linear feature (earth bund/wall) in the DEM that I would like to shade/colour based on its elevation above the surrounding ground level on which it is built. I have provided an example output below copied from another project, with the red area representing a gap in the earth bund and the green representing the desired 2m above ground level. I'd like to recreate this example using my DEM.

Example

Shading the whole DEM based on elevation is not an option due to the size and range of elevations present, as well as the varying ground level along the earth bund. I suspect the method involves clipping the relevant bund area from the DEM and some clever work in the Raster Calculator that looks at adjacent values, e.g. Pixel X from within the bund area is compared to Pixel Y located 10m perpendicular to Pixel X, outside of the bund area.

  • Might be best to share an example image. Can't really picture what you are describing. – HeikkiVesanto Jul 4 '18 at 10:43
  • Example: the bund/wall with a height of 2m "standing" on raster value 245m should get a "height" 247m. Am I right? – Stefan Jul 5 '18 at 5:11
  • Correct - it would be easy if I had a DEM before and after the wall was constructed, being a simple case of subtracting one from the other. As I don't, the calculation will need to look at values at the toe of the bund. – James Jul 5 '18 at 5:50
  • Another example (same methodology, different use) would be showing the depth of an erosion gully on the side of a steep slope, with deeper values shown as red and shallow ones as green. Again, the method would need to be based on surrounding ground levels, not the actual elevation values. – James Jul 5 '18 at 6:04
1

I found a solution that works well. It involves creating a surrogate 'pre-construction' layer by flattening the area beneath the bund, and then subtracting this from the original. The exact method is detailed below:

  1. Create new layer and draw a detailed polygon around the bund perimeter. This will be used as a mask layer in subsequent steps.
  2. Create new polygon layer and draw a polygon that comfortably encompasses entire bund.
  3. Use Symmetrical Difference to remove bund mask layer (Step 1) from the encompassing bund layer from Step 2.
  4. Use Clip Raster by Mask Layer on the elevation model, with the layer from Step 3 selected. This creates a new raster with the bund mask area deleted (replaced with null values).
  5. Use GDAL Fill NoData to fill null values with interpolated ground levels from adjacent pixels (use pixel width from layer info to calculate how many pixels to use, e.g. if wanting to look 5m beyond bund area and with a pixel width of 0.06, 5/0.06= 83 pixels).
  6. Use Clip Raster by Mask Layer on the raster produced in Step 5, with the layer from Step 1 selected (bund mask area). This creates a surrogate pre-construction layer beneath the bund.
  7. Use the Raster Calculator to subtract the surrogate pre-construction layer (Step 6) from the original elevation model.
  8. Stylise with a single band pseudo colour ramp as desired (e.g. >2m = green, 1.5 - 2m = yellow, <1.5 = red).

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.