sum_network_links: Summarise links from shortest paths data

Description Usage Arguments Details Examples

View source: R/SpatialLinesNetwork.R

Description

Summarise links from shortest paths data

Usage

1
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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(routes_fast)
rnet <- overline(routes_fast, attrib = "length")
SLN <- SpatialLinesNetwork(rnet)
weightfield(SLN) # field used to determine shortest path
shortpath <- sum_network_links(
    SLN,
    data.frame(
        start=rep(c(1,2,3,4,5),each=4),
        end=rep(c(50,51,52,33),times=5)
    )
)
plot(shortpath, lwd=shortpath$count)

stplanr documentation built on June 3, 2018, 1:04 a.m.