This functions creates a blank SpatRaster based on the spatial extent of a sf object.

blank.raster(x, res)

Arguments

x

sf::st_sf() object.

res

numeric vector specifying resolution of the output raster in the x and y dimensions. If vector is of length one, then the pixels are assumed to be square.

Examples

# \dontrun{
# make sf data
polys <- sim.pus(225L)

# make raster from sf
blank.raster(polys, 1)
#> class       : SpatRaster 
#> dimensions  : 15, 15, 1  (nrow, ncol, nlyr)
#> resolution  : 1, 1  (x, y)
#> extent      : -7.5, 7.5, -7.5, 7.5  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 
#> source(s)   : memory
#> name        : lyr.1 
#> min value   :     1 
#> max value   :     1 
# }