stplanr (version 0.3.1)

sum_network_links: Summarise links from shortest paths data

Description

Summarise links from shortest paths data

Usage

sum_network_links(sln, routedata)

Arguments

sln

The SpatialLinesNetwork or sfNetwork to use.

routedata

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.

Details

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

Other rnet: SpatialLinesNetwork, calc_catchment_sum, calc_catchment, calc_moving_catchment, calc_network_catchment, find_network_nodes, gsection, islines, lineLabels, overline2, overline, plot,SpatialLinesNetwork,ANY-method, plot,sfNetwork,ANY-method, sln2points, sum_network_routes

Examples

Run this code
# NOT RUN {
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
library(sf)
shortpath_sf <- sum_network_links(sln_sf, nodes_df)
plot(shortpath_sf["count"], lwd = shortpath_sf$count, add = TRUE)
# }

Run the code above in your browser using DataLab