Create raster of equally spaced cells. The distance between centre of cells in both x and y dimension is equal to cell_size.

create_raster(geometry, cell_size, side_offset = 0)

Arguments

geometry

sf data.frame containing geometry which should be cover by the raster.

cell_size

numeric specifying the distance for equally spaced cells.

side_offset

numeric specifying the side offset, distance added to the convex hull of input geometry to generate raster for KDE. Good estimate is usually the same value as band width of KDE.

Value

Raster-class

Examples

library(sf)
nc <- st_read(system.file("shape/nc.shp", package = "sf")) %>% st_transform(32031)
#> Reading layer `nc' from data source 
#>   `/home/runner/work/_temp/Library/sf/shape/nc.shp' using driver `ESRI Shapefile'
#> Simple feature collection with 100 features and 14 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
#> Geodetic CRS:  NAD27
raster <- create_raster(nc, cell_size = 100000)