Clips a raster using a polygon, preserving the coordinate reference system (CRS) of the raster.
See also
Other clip functions:
clip_layer()
,
clip_multipoligon()
,
generate_bbox()
Examples
source_gpkg <- system.file("extdata", "sigugr.gpkg", package = "sigugr")
p <-sf::st_read(source_gpkg, layer = 'lanjaron', quiet = TRUE)
source_tif <- system.file("extdata", "sat.tif", package = "sigugr")
r <- terra::rast(source_tif)
result <- clip_raster(r, p)