# Calculating Distance from Outlet to Dam(s) using ArcGIS Desktop?

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.

• What if there are multiple upper most points? Oct 3 '18 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. Oct 3 '18 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
Oct 3 '18 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
Oct 4 '18 at 13:52

If you are capable to populate tables of your data (links, nodes) accordingly: I recommend networkx module, e.g. this tiny script computes distance to outlet for every node in network:

``````import arcpy
import networkx as nx