I am trying to carry out what should be a relatively simple analysis of river network fragmentation by dams. Similar questions have been asked as:

What I would like to achieve is:

  • Calculate the distance from river outlet upstream to first dam on each river/tributary
  • Calculate the cumulative number of dams from the outlet to the uppermost point

The data I am working with is:

  • hydrosheds 15 arc second river network. This data set includes IDs ("arcid") for numerous small segments of the polyline river network.

  • A point dam data set

Many answers, like a comment on Finding distance from river outlet to points, following river, using ArcGIS Desktop?, refer to a computer program, RivEX, and end there. I acknowledge the potential utility of this program, but I would like to work through the steps and run these calculations in ArcGIS Desktop.

Is creating a geometric network the right approach in this case or is there another tool that could use the built-in hydrosheds line ID and calculate distance from outlet to point (dam)?

In essence, I am unsure of how to work with the arcid field (specifying the relative position in the watershed) and represent the dams as nodes.

  • 1
    What if there are multiple upper most points?
    – FelixIP
    Commented Oct 3, 2018 at 8:08
  • I should disclose I am the Author behind RivEX. You don't give a scale to your problem. Are you trying to compute these metrics for the whole of a continent or a single catchment? If you don't want to use third party applications then you could do this manually if just a catchment. Then the time you take is that cheaper than buying a bit of software? If you manually selected up the first dams, which would require you to manually scan the network then you could use modelbuilder to build the routes and do some post table sorting.
    – Hornbydd
    Commented Oct 3, 2018 at 10:50
  • @Hornbydd, the price is not the issue (it indeed would be cheaper to use RivEx). However, I would also like to learn the underlying mechanics. The basin(s) in question are around 300,000 km^2 total, so not continent size, but also not small and therefore a semi-automated approach is necessary. If I continue to experiment with this in the longer term I think using a Python script may be a way to automate this and be able to apply to other basins if desired. I will take a look at RivEx too.
    – Dan
    Commented Oct 3, 2018 at 16:19
  • @FelixIP there are multiple uppermost points (upstream sources). I am mainly interested in the distance from the downstream most points (outlet, of which there is one ID for this data) to a given point upstream in the network.
    – Dan
    Commented Oct 4, 2018 at 13:52

1 Answer 1


If you are capable to populate tables of your data (links, nodes) accordingly: enter image description here

I recommend networkx module, e.g. this tiny script computes distance to outlet for every node in network:

import arcpy
import networkx as nx
with arcpy.da.SearchCursor(links,("fi","ti","length")) as cursor:
    for f,t,w in cursor:G.add_edge(f,t,weight=w)
with arcpy.da.UpdateCursor(nodes,("fid","travel")) as cursor:
    for node,travel in cursor:
  • thank you for the link to networkx. This looks promising as well. I probably will not go this route at the moment, but in the long term it looks like it could be used as part of a useful python approach.
    – Dan
    Commented Oct 4, 2018 at 14:16

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.