Clips a raster to a polygon bounding box, optionally masks to polygon, and saves the output in the same format as the input.
Arguments
- input_path
Character. Path to the input raster file.
- polygon
An object or file coercible to a `SpatVector` by `terra::vect()` (e.g., an `sf` object, a `SpatVector`, or a file path to a vector dataset). used for clipping and masking. Must have a valid CRS.
- out_path
Character. Path to save the processed raster.
- mask
Logical: Should pixels outside the polygon but inside its bounding box be masked out (TRUE) or included (FALSE)?
- overwrite
Logical: Replace output file if it already exists?