I'm trying to extract ditches using the LIDAR DTM using the software eCognition but I am actually having a hard time since the paper where I based my workflow entitled "Ditches’ network extraction and hydrogeomorphological characterization using LiDAR-derived DTM in wetlands" doesn't have detailed rulesets that were input in eCognition.

I just want to ask, who among you here have an idea how to extract ditches in agricultural landscapes or maybe in an urban setting perhaps, the ones alongside roads?

Or if ever you haven't done such work or project, who else might have a bright idea that will enable me to extract ditches.


I've had to map ditches from 1 m LiDAR derived DEMs of agricultural landscapes before. It's certainly a challenging task to come up with a workflow that is suitable. You're ability to successfully extract a ditch network will depend on a number of factors. For example, are you only interested in roadside ditches? If so, are the roads on embankments (as is usually the case in agricultural settings) and do you have an accurate road vector file (this can be critical for this task)? Or are you also interested in in-field drainage ditches? Do you have the raw LiDAR point cloud, or just an interpolated DEM? If you have the later, then it is critical that you do not apply any kind of smoothing filter, which unfortunately is commonly done with LiDAR DEMs because of their excessive surface roughness, prior to the analysis. Unfortunately, a low-lying roadside ditch is easily removed with a 3 x 3 mean filter in a 1 m DEM. If you have the LiDAR point cloud, then I would recommend interpolating your DEM grid using a Nearest Neighbour interpolation scheme (assuming a high point density) because, although this will increase the surface roughness compared with something like IDW, it will better preserve the ditches.

Now, assuming you have a road vector and that you are only interested in roadside ditches, here is a workflow that you might use:

  1. Perform a difference-from-mean elevation filter. In the open-source GIS Whitebox Geospatial Analysis Tools, which I used for this task, there is literally a tool called 'Difference From Mean Elevation' (DFME) that is ideal for this workflow. However, if you for some reason can't use Whitebox, then perform a traditional mean filter (box-car filter) and subtract the result from the original DEM (a 'high-pass' filter can also be used). You may have to experiment with the filter size, which will depend on the width of your ditch features but should be slightly wider than the ditches. For my data, I set the 'Search Neighbourhood Size' parameter of the DFME tool to 5 cells, which would create an 11 x 11 filter.

  2. You will need to threshold the DFME raster to extract all grid cells with a 'low' DFME value. Again, this will depend on your data, and particularly on the depth of the ditches within your DEM. I simply used the Whitebox Raster Calculator for this, with an expression of [low cells]=[DFME]<(-0.15). The units of that '0.15' parameter in the threshold are the same as the z-units of your DEM. This is effectively saying, give me all the grid cells that lie at least 15 cm (my DEM is in metres) below their surroundings.

  3. Buffer your road vector such that it creates a road mask that is wide enough to include the road and its roadside ditches. This will depend on the width of your road. If you have an extensive site, there may actually be multiple road widths, e.g. main roads are generally wider than secondary roads. In my case, a road buffer of 10 m worked well.

  4. Convert this road buffer polygon to a raster, using the DFME or DEM as the base image from which the output raster will derive its resolution and extent. You may want to previously clip your road buffer to the layer footprint of the raster grid to speed-up this process if you have a more extensive vector road network than your DEM site, which was the case for me. Depending on how the vector-to-raster conversion works, you may have reassign the values in the road buffer raster to be 1 for roads and 0 for everything else. Again, the Raster Calculator can be useful for this.

  5. Multiply your final Boolean road buffer raster by your thresholded DFME image.

  6. You may, if you're really classy, want to then apply a line-thinning algorithm to the raster resulting from step 5 in order to create a nice thin line network of roadside ditches.

In the image below, the roadside ditch network is shown in black, overlayed on top of the DFME image with the DEM's hillshade showing transparently through. I think it worked reasonably well in this case, but again, it requires a bit of finness and playing around with various parameters.

enter image description here

If it turns out that you aren't just interested in roadside ditches then there is a tool in Whitebox called Map Gully Depth, that could possibly be used for this task depending on your data and landscape. It's a tough one to use, so give me an email if you decide to go this route and I'll be happy to give some guidance. The main issue is that it is hard to use surface flow patterns (e.g. flow accumulation images) to map ditches because, unlike with streams, ditches in agricultural settings are used as much for temporary water storage as they are for water conveyance. They don't generally have the gradients that you find in natural streams. Nonetheless, I've developed a depression breaching algorithm in Whitebox that can be used to improve the drainage through ditches, which could also be useful for mapping in-field ditches. Again, care is required here so if this is the route you need to go, then contact me and I'd be happy to help.

| improve this answer | |
  • Thank you so much for the pieces of info you have shared regarding ditch extraction @WhiteboxDev. I will be more than happy to be connected with you since I think you have all the necessary ideas I need to fulfill my goal: ditch extraction. I am actually interested both in roadside ditches and the ditches you see in agricultural landscapes, the ones that form networks. I am going to try extracting roadside ditches using the workflow you mentioned above, but I don't have the Whitebox GAT software yet. Is it for free? Where can I download the installer? For the meantime, maybe ArcGIS will do for – user36706 Sep 7 '14 at 14:56
  • 1
    Hello @DitchExtractor yes, Whitebox is open-source and free software that runs on Windows, Mac, and Linux. You can get it by following the link in my answer, which will bring you to the project's main page. Then select download. My contact information is there as well if you'd like to contact me directly. – WhiteboxDev Sep 7 '14 at 18:17

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.