create_grid_rectangular {SpatialKDE} | R Documentation |
Create grid
Description
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
.
Usage
create_grid_rectangular(
geometry,
cell_size,
side_offset = 0,
only_inside = FALSE
)
create_grid_hexagonal(
geometry,
cell_size,
side_offset = 0,
only_inside = FALSE
)
Arguments
geometry |
|
cell_size |
|
side_offset |
|
only_inside |
|
Value
sf
data.frame
.
Functions
-
create_grid_rectangular()
: Create rectangular grid -
create_grid_hexagonal()
: Create hexagonal grid
Examples
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)