The {wk}
package provides a very fast alternative to create a polygon grid
compared to sf::st_make_grid()
.
library("sf")
library("wk")
## sf
system.time({
bbox = st_bbox(c(xmin = 0, xmax = 500, ymin = 0, ymax = 500))
grid = st_make_grid(bbox, cellsize = 1, what = "polygons")
})
## user system elapsed
## 7.47 0.06 7.54
## wk
system.time({
bbox = rct(xmin = 0, xmax = 500, ymin = 0, ymax = 500)
grid = grd(bbox, dx = 1, dy = 1, type = "polygons")
grid = st_as_sfc(grid) # convert to sfc
})
## user system elapsed
## 0.56 0.02 0.58