Convert straight OD data (desire lines) into routes
line2route(
l,
route_fun = stplanr::route_cyclestreets,
n_print = 10,
list_output = FALSE,
l_id = NA,
time_delay = 0,
...
)
A spatial (linestring) object
A routing function to be used for converting the straight lines to routes
od2line()
A number specifying how frequently progress updates should be shown
If FALSE (default) assumes spatial (linestring) object output. Set to TRUE to save output as a list.
Character string naming the id field from the input lines data, typically the origin and destination ids pasted together. If absent, the row name of the straight lines will be used.
Number or seconds to wait between each query
Arguments passed to the routing function, e.g. route_cyclestreets()
See route_cyclestreets()
and other route functions for details.
A parallel implementation of this was available until version 0.1.8.
Other routes:
line2routeRetry()
,
route_dodgr()
,
route_graphhopper()
,
route_local()
,
route_transportapi_public()
,
route()
# NOT RUN {
# does not run as requires API key
l <- flowlines[2:5, ]
r <- line2route(l)
rq <- line2route(l = l, plan = "quietest", silent = TRUE)
rsc <- line2route(l = l, route_fun = cyclestreets::journey)
plot(r)
plot(r, col = "red", add = TRUE)
plot(rq, col = "green", add = TRUE)
plot(rsc)
plot(l, add = T)
# Plot for a single line to compare 'fastest' and 'quietest' route
n <- 2
plot(l[n, ])
lines(r[n, ], col = "red")
lines(rq[n, ], col = "green")
# }
Run the code above in your browser using DataLab