Summarise links from shortest paths data

sum_network_links(sln, routedata)



The SpatialLinesNetwork or sfNetwork to use.


A dataframe where the first column contains the Node ID(s) of the start of the routes, the second column indicates the Node ID(s) of the end of the routes, and any additional columns are summarised by link. If there are no additional colums, then overlapping routes are counted.


Find the shortest path on the network between specified nodes and returns a SpatialLinesDataFrame or sf containing the path(s) and summary statistics of each one.

See also


sln_sf <- SpatialLinesNetwork(route_network_sf) plot(sln_sf)
nodes_df <- data.frame( start = rep(c(1, 2, 3, 4, 5), each = 4), end = rep(c(50, 51, 52, 33), times = 5) ) weightfield(sln_sf) # field used to determine shortest path
#> [1] "length"
library(sf) shortpath_sf <- sum_network_links(sln_sf, nodes_df) plot(shortpath_sf["count"], lwd = shortpath_sf$count, add = TRUE)