Create grid
grid_res.Rd
This function creates a grid inside a specified polygon.
Arguments
- km
grid cell resolution in km. one-sided length of grid cell, assumes desired grid cell is to be squared
- study_site
simple feature polygon object in which grid cells should be created
- epsg
epsg numeric code for desired coordinate system transformation
- what
"polygons"
for grid cell polygons or"centers"
for center points of grid cells
Examples
# NOTE: The study site must be in a projected coordinate system (e.g., WGS 84; EPSG: 3857)
# when it is initially fed into the function grid_res
library(sporeg)
library(dplyr)
library(sf)
load(system.file("extdata", "site_depth.Rda", package = "sporeg"))
site_depth <- site_depth %>% sf::st_transform(., 3857)
HS_100km_grid <- grid_res(100, site_depth, 4269, "polygons")
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries