I have a shapefile of contours that I generated from LiDAR data on QGIS. I'm trying to create a line that follows the lowest point of elevation across the entire map that follows a ditch (it's a long section).

Is this possible to do this with a tool or do I need to draw the line manually?

  • r.drain from GRASS processing tools can do this. But you need to create an elevation raster from your LiDAR data first.
    – MrXsquared
    Feb 7, 2021 at 21:35

1 Answer 1


What does "lowest point of elevation" mean in this case? How complex is the elevation dataset? Your ditch might be "locally" lowest, but not globally for your dataset.

Like MrXsquared mentions, you'll need an elevation raster instead of a set of contours. You can either create this from your LiDAR data directly, but luckily there's a QGIS tutorial on exactly on that topic:


After you've done that, I'm guessing you want to what's typically called "watershed delineation" or "tracing a flow". There's also a QGIS tutorial on this topic, which appears to be using the SAGA toolbox (which can be installed with QGIS): https://docs.qgis.org/3.16/en/docs/training_manual/processing/hydro.html?highlight=hydrological%20analysis

This is documentation to the page MrXsquared mentions in his comment: https://grass.osgeo.org/grass78/manuals/r.drain.html Which does similar things.

I'm not very familiar with GRASS GIS, so I'd probably have a go at it with Python. There's two packages that I have some familiary with:

The second one has the advantage of producing vector data (line features).

Most methods seems to produce a raster, rather than vector data of your drain location. Again, there's more Python packages to help:


But you'd have to polygonize the drain outline first, most likely. See e.g. this answer:

How to polygonize raster to shapely polygons

So it depends a little on what you need and want! If it's a relatively small dataset and it's a one-off task, just drawing it by hand might be quickest.

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.