create_grid_rectangular | R Documentation |
Create grid of equally spaced rectangles or hexagons. The distance between centre points
in both x and y dimension is equal to cell_size
. The function is effectively a wrapper around
st_make_grid
with a little bit of preprocessing including generation of grid only inside
st_convex_hull
.
create_grid_rectangular( geometry, cell_size, side_offset = 0, only_inside = FALSE ) create_grid_hexagonal( geometry, cell_size, side_offset = 0, only_inside = FALSE )
geometry |
|
cell_size |
|
side_offset |
|
only_inside |
|
sf
data.frame
.
create_grid_rectangular()
: Create rectangular grid
create_grid_hexagonal()
: Create hexagonal grid
library(sf) nc <- st_read(system.file("shape/nc.shp", package = "sf")) %>% st_transform(32031) grid <- create_grid_hexagonal(nc, cell_size = 100000) grid <- create_grid_rectangular(nc, cell_size = 100000, only_inside = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.