# NOT RUN {
library(sf)
l = od_data_lines[2, ]
r_walk = route(l = l, route_fun = route_osrm, osrm.profile = "foot")
r_bike = route(l = l, route_fun = route_osrm, osrm.profile = "bike")
plot(r_walk$geometry)
plot(r_bike$geometry, col = "blue", add = TRUE)
# }
# NOT RUN {
# r_bc = route(l = l, route_fun = route_bikecitizens)
# plot(r_bc)
# route(l = l, route_fun = route_bikecitizens, wait = 1)
library(osrm)
r_osrm <- route(
l = l,
route_fun = osrmRoute,
returnclass = "sf"
)
nrow(r_osrm)
plot(r_osrm)
sln <- stplanr::SpatialLinesNetwork(route_network_sf)
# calculate shortest paths
plot(sln)
plot(l$geometry, add = TRUE)
r_local <- stplanr::route(
l = l,
route_fun = stplanr::route_local,
sln = sln
)
plot(r_local["all"], add = TRUE, lwd = 5)
# }
Run the code above in your browser using DataLab