Divides the region of interest in a grid of a specific cell size.
Arguments
- region
SpatVector object of a polygon for the region of interest. Object projection must be World Geodetic System (WGS84).
- cell_size
(numeric) resolution for grid (single number or vector of two numbers) in kilometers (km).
- complete_cover
(logical) whether or not to include cells of grid partially overlapped with region. Default = TRUE.
Value
Grid SpatVector for the region of interest. Each grid cell is related to a specific ID and longitude and latitude coordinates.
Examples
# Data
mx <- terra::vect(system.file("extdata/mx.gpkg", package = "biosurvey"))
# Create grid from polygon
grid_reg <- grid_from_region(region = mx, cell_size = 100)
terra::plot(grid_reg)