If I have a DEM as raster layer and a point with defined position in a point layer, how could I generate a line with defined slope of e.g. -1%? The end point can be anywhere and should be defined by the line length and the constant downward slope of 1%. The line should have nodes every one or two meters, so that it follows the terrain with that accuracy.

The goal is to construct an irrigation ditch that almost follows the contour, but is defined by an optimal downward slope. If I can design it this way over a DEM with resolution <1m, I can stake it out with an RTK positioning system and have it dug accordingly.

Any ideas for a workflow or code?

I'm working in QGIS 2.18.

Red line shows the line I'd like to generate at 1% slope compared to the contour line

closed as too broad by Vince, whyzar, gisnside, xunilk, csk Jun 18 '18 at 16:13

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Welcome to GIS SE. Thank you for taking the Tour. "Is there a way?" questions tend to generate the only possible answer: "Sure, if you work at it." If your goal is to do anything automatically, there's going to be the hard work of doing in the middle of the automation. Depending on the inputs, this appears to be a NP-hard problem, so you need to be prepared for a lot of complex code, falling well short of your goal in terms of automation. – Vince Jun 18 '18 at 12:45
  • Do you have an end point? You could look into a least cost path analysis. Re-run the analysis with different preferred end points and you can get close to what you need – Liam G Jun 18 '18 at 13:10
  • I guess the end point is on the dem... The line drawn would have to "find the dem" but i feel starting from a point is not really ideal. In CAD software, one can make the software draw a 3D line from a point to its projected equivalent on the dem with a defined slope. This question should be more detailed with some graphical explanation. – gisnside Jun 18 '18 at 15:02

Browse other questions tagged or ask your own question.