River Network Distance Computation and Applications

The ‘riverdist’ package is intended as a free and readily-available resource for distance calculation along a river network. This package was written with fisheries research in mind, but could be applied to other fields. The ‘riverdist’ package builds upon the functionality of the ‘sf’ package, which provide the utility of reading GIS shapefiles into the R environment. What ‘riverdist’ adds is the ability to treat a linear feature as a connected network, and to calculate travel routes and travel distances along that network.

Note that the current version of ‘riverdist’ (>= 0.16.0) is no longer built on ‘sp’ and ‘rgdal’ and is not backward-compatible. A legacy version that uses ‘sp’ / ‘rgdal’ (‘riverdist’ 0.15.5) can be installed via

remove.package("riverdist") if needed devtools::install_github("mbtyers/riverdist@legacy")

Commonly-used functions

Several automated analyses are built in. In most cases, there is a direction or directional distance equivalent.

Summaries and plots are also available at the dataset level, in addition to individuals, which is likely to be much more useful to analysis.


Version 0.16.0 of the ‘riverdist’ package is available on CRAN.

The development version is currently available on Github, and can be installed in R with the following code: