Make grid
make_grid(
x,
hexagonal = TRUE,
cell_area,
clip = FALSE,
grid_boundary = FALSE,
tolerance = NULL
)Object of class sf, sfc, sfg, SpatialPolygons
logical. If TRUE then the geometry grid will be hexagonal otherwise it will be square.
numeric. Grid area in the CRS units of object x.
logical. If TRUE, the new grid will be clipped to the x geometry.
The operation time will be longer the greater the number of vertices in the polygon of the region.
If it is a region with many vertices use the parameter tolerance.
logical. If TRUE, the "hexagons" or "squares" in the boundaries (i.e, that are not completely within the geometry x) will be removed.
numeric. Reduces the number of vertices in the x polygon by simplifying its shape (see, st_simplify). It must be specified in meters
Returns a class object sf with a hexagonal or square polygon grid.
if (FALSE) { # \dontrun{
library(Makurhini)
library(sf)
data("study_area", package = "Makurhini")
test <- make_grid(x = study_area, hexagonal = TRUE,
cell_area = unit_convert(10, "km2", "m2"))
plot(test)
test <- make_grid(x = study_area, hexagonal = TRUE,
cell_area = unit_convert(10, "km2", "m2"),
clip = TRUE)
plot(test)
test <- make_grid2(x = study_area, hexagonal = TRUE,
cell_area = unit_convert(10, "km2", "m2"),
grid_boundary = TRUE)
plot(st_geometry(study_area)); plot(test, add = T)
} # }