3

I am creating contours from a DEM that has been hydrologically corrected via a Breach Depressions algorithm. The DEM is coloured light grey to dark grey (top to bottom), the stream is in blue and the contours in yellow. The stream runs from top to bottom of the image. The breach is quite deep relative to the surrounding terrain, as the stream is in fact a narrow slot canyon.

enter image description here Unfortunately, the contours from that DEM are producing sinks rather than following the line of the stream, presumably because the stream is only 1 pixel wide.

The desired contours are roughly shown in green below. Is there an approach that will produce those contours?

enter image description here

2
  • I would guess that the interval between contour lines is too close, compared to the resolution of the DEM.
    – Micha
    Commented Mar 17, 2021 at 13:24
  • @Micha - the issue is more that the depth of the breaching in this particular location is greater than the contour interval. There are close contour lines in other parts of the DEM (eg cliff areas) which don't cause problems for the contour algorithm Commented Mar 17, 2021 at 20:46

1 Answer 1

1

I've tried quite a lot of different approaches to process the underlying DEM so that the generated contours don't contain spurious sinks. The approaches involved a mix of filters, and warping the DEM to double the resolution.

Of all of the approaches, there were two that gave reasonable results, so I'll post them for the benefit of others grappling with the same situation.

1. Minimum Filter

The simplest option is to run a 3x3 Minimum Filter over the DEM, and then generate contours. Whitebox Tools has a Minimum Filter (x=3,y=3). You could probably also use SAGA Rank Filter with a radius of 1 and a Rank of 0%.

This resolves the sink issue, but it does cause all of the new contours to be shifted some distance back from the original contours (new ones in pink vs original in orange)

enter image description here

2. Adjust Resolution and Rank Filter

This is similar to (1), but takes a slightly more sophisticated approach. It is more complex and time-consuming, but appears to give superior results.

  1. Adjust the resolution of the image to double the size. My DEM is 2m, so GDAL Warp with an output file resolution of 1 will do this.
  2. Apply a Rank Filter (SAGA -> Raster Filter -> Rank Filter) with radius 1 (ie 3x3) and threshold 33.
  3. Generate contours

This also appears to resolve the sink issue, and the contours are well aligned to the original ones. In the canyon area, they may in fact be a better representation than the ones I presented in the question! The main downsides are the extra processing step and extra processing power/memory required due to the larger DEM and the use of Rank Filter. (new ones in green vs original in orange)

enter image description here

Summary

The Minimum Filter method introduces a shift of the contours approximately the size of the DEM resolution (2m in my case).

The Adjust Resolution and Rank Filter method introduces a shift of the contours of about 0.5m on a 2m resolution DEM, though it ranges from about 0.1-0.8m.

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.