The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The code in this vignette provides a basic introduction to parallel routing. Routing is something that is highly parallelisable because each route can be calculated independently of the others. The code should be fairly self-explanatory. No results are shown and the code is not run to reduce package build times.
library(stplanr)
library(sf)
library(dplyr)
library(tmap)
library(parallel)
library(cyclestreets)
# ?route
flowlines_sf %>%
l = dplyr::filter()
Sys.time()
t1 = line2route(l)
routes_route_cyclestreet =Sys.time() - t1
ncol(routes_route_cyclestreet)
nrow(routes_route_cyclestreet)
names(routes_route_cyclestreet)
dplyr::inner_join(routes_route_cyclestreet, sf::st_drop_geometry(l))
routes_route_cyclestreet_joined =Sys.time() - t1
overline(routes_route_cyclestreet_joined, "All")
rnet_go_dutch =Sys.time() - t1
tm_shape(rnet_go_dutch) +
tm_lines(lwd = 5, col = "All", breaks = c(0, 10, 100, 500, 1000), palette = "viridis")
# ?route
Sys.time()
t1 = route(l = l, route_fun = cyclestreets::journey)
routes_journey =ncol(routes_journey)
nrow(routes_journey)
Sys.time() - t1
names(routes_journey)
overline(routes_journey, "All")
rnet_go_dutch_journey =Sys.time() - t1
overline(routes_journey, "All")
rnet_go_dutch_agg =Sys.time() - t1
tm_shape(rnet_go_dutch_agg) +
tm_lines(lwd = 5, col = "All", breaks = c(0, 10, 100, 500, 1000), palette = "viridis")
# ?route
Sys.time()
t1 =
# load parallel stuff
makeCluster(detectCores())
cl <-clusterExport(cl, c("journey"))
Sys.time() - t1
route(l = l, route_fun = cyclestreets::journey, cl = cl) # multi-core
routes_journey_par =stopCluster(cl) # kill cluster
Sys.time() - t1
Sys.time() - t1
names(routes_journey_par)
overline(routes_journey_par, "All")
rnet_go_dutch_journey =Sys.time() - t1
overline(routes_journey_par, "All")
rnet_go_dutch_agg =Sys.time() - t1
tm_shape(rnet_go_dutch_agg) +
tm_lines(lwd = 5, col = "All", breaks = c(0, 10, 100, 500, 1000), palette = "viridis")
# ?route
Sys.time()
t1 =
# load parallel stuff
library(parallel)
library(cyclestreets)
makeCluster(detectCores())
cl <-clusterExport(cl, c("journey"))
Sys.time() - t1
route(l = l, route_fun = cyclestreets::journey, cl = cl, plan = "quietest") # multi-core
routes_journey_par =stopCluster(cl) # kill cluster
Sys.time() - t1
Sys.time() - t1
names(routes_journey_par)
overline(routes_journey_par, "All")
rnet_go_dutch_journey =Sys.time() - t1
overline(routes_journey_par, "All")
rnet_go_dutch_agg =Sys.time() - t1
tm_shape(rnet_go_dutch_agg) +
tm_lines(lwd = 5, col = "All", breaks = c(0, 10, 100, 500, 1000), palette = "viridis")
routes_journey %>% # already has data from data frame in there!
routes_journey_aggregated = group_by(id) %>%
summarise(All = median(All)) %>%
sf::st_cast("LINESTRING")
routes_journey %>% # already has data from data frame in there!
rnet_journey_dplyr = group_by(name, distances) %>%
summarise(All = sum(All))
Sys.time() - t1
tm_shape(rnet_journey_dplyr) +
tm_lines(lwd = 5, col = "All", breaks = c(0, 10, 100, 500, 1000), palette = "viridis") # quite different...
routes_journey %>%
rnet_journey_go_dutch = group_by(start_longitude, start_latitude, finish_longitude, finish_latitude) %>%
summarise(All = sum(All))
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.