How do I determine how many barriers are downstream of each sampling location on a river network using GRASS?


I have ~20,000 points, soon to be ~600,000 points, falling on or near a river network of Europe. The points are sampling locations and barrier locations. I also have nodes for the river network. Network and node layers (ECRIN for those familiar with European river networks) have attributes relating to segment_length, distance2mouthLine, is_source, is_mouth, basin_id and segment_id.

What I've tried

Thus far I've tried v.distance in GRASS to calculate the distance going upstream for each point along a river segment which I then subtracted from the segments distance2mouthLine to provide a distance2mouthPoint value for each point. Using this I counted all of the points with a distance2mouthPointless than each point with the same basin_id. Unfortunately this included barriers on different river branches rather than those along the path from the point to the river mouth.

I have investigated Linear Referencing in ArcGIS, however the distance along the network is the same as that which I calculated in GRASS and therefore has the same limitations. Network Analyst in ArcGIS also provides a similar metric and I'm unaware of how to automate it rather than manually select each start and end point.

Any idea if this can be achieved in GRASS by identifying something like each source to mouth path and using v.distance as above?


1 Answer 1


Depends on your data attributes. If your river network was generated with archydro you could use the nextdownid field (or similar if available from another method) to query where the flow is going using a postgresql RECURSIVE query, after loading the river network into a postgis database. https://www.postgresql.org/docs/9.1/static/queries-with.html This would give you the path, then use this geometry in a query to select the barriers or other points of interest. If they are off the line include a WITHIN / buffer in the query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.