Two new functions are available in the dev version of r5r jar: getGrid()
and findSnapPoints()
.
getGrid()
uses R5 functionality to generate a grid of regularly spaced cells in the Web Mercator projection, at a given zoom level.
findSnapPoints()
is useful to analyse the actual origins and destinations of trips on the road network. Since R5's link radius is set to 1.6km, the actual linkage point can be located quite far away from the original location.
To install the development version of r5r
, use:
utils::remove.packages('r5r')
devtools::install_github("ipeaGIT/r5r", subdir = "r-package", ref = "dev")
Reproducible example of getGrid()
and findSnapPoints()
:
library(r5r)
# initialize r5r
data_path <- system.file("extdata/poa", package = "r5r")
r5r_core <- setup_r5(data_path, verbose = FALSE)
# get regular grid at resolution 8
grid_df <- r5r_core$getGrid(8L)
grid_df <- jdx::convertToR(grid_df)
# snap grid to street network
snap_df <- r5r_core$findSnapPoints(grid_df$id, grid_df$lat, grid_df$lon, "CAR")
snap_df <- jdx::convertToR(snap_df)
mv1 <- mapview::mapview(snap_df, xcol="lon", ycol="lat", crs=4326)
mv2 <- mapview::mapview(snap_df, xcol="snap_lon", ycol="snap_lat", zcol="found", crs=4326)
leafsync::sync(mv1, mv2)
The result will be the following:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4