I know this topic has been discussed before in this forum , I read all the suggestions but I think I still have the same issue.

Working with QGIS, I'm supposed to compute the slope of river channels and then be able to classify them in classes. For that, I'm working with a DEM 90m resolution and a river network derived from the openstreetmap database.

As my DEM gave me wrong values for some slopes because it sometimes don't consider my rivers as lowest points of my valleys, I would like to run a script that enable me compute my slope using obviously the right elevations of the DEM.I've joined a picture of the network I'm working on and here are the manipulations I've done so far after many days of vain efforts.

  1. I decided to split my streams with the extension "Network" into segments with different lenghts and using the tool "connect" I've got nodes with IDs that increases from upstream->downstream .
  2. I assigned to each of these nodes its corresponding elevation from the DEM 90m

In the picture black numbers corresponds to the ID node which are classified and the red numbers correpond to the elevations!

As you can see I've circled two nodes where the algorithm I guess don't recognise the bifuraction of the river! I wonder if there's a solution to this issue too!

I've got sometimes wrong elevations at some points ( e.g the elevation sometimes increases going downstream!!) I guess it's normal because this odd point sometimes is the value of a pixel located on a tree for example in the bank river! so the correct elevation is just in the adjacent pixel !

Being not well skilled in coding, how can I go from a point in the river to the upstream and whenever there's an odd value of elevation, the script skipped it and goes to the right one upstream and then calculate the distance between the points so as to find the slope?

enter image description here

closed as off-topic by PolyGeo Apr 19 '16 at 4:45

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking help to debug/write/improve code must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Providing a clear problem statement and evidence of a code attempt will help others to help you. See: How to create a Minimal, Complete, and Verifiable example." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.