mask.Rd
If x
is a SpatRaster
:
Create a new SpatRaster that has the same values as SpatRaster x
, except for the cells that are NA
(or other maskvalue
) in another SpatRaster (the 'mask'), or the cells that are not covered by a SpatVector. These cells become NA
(or another updatevalue
).
If x
is a SpatVector
:
Select geometries of x
that intersect, or not intersect, with the geometries of y
.
# S4 method for SpatRaster,SpatRaster
mask(x, mask, inverse=FALSE, maskvalues=NA,
updatevalue=NA, filename="", ...)
# S4 method for SpatRaster,SpatVector
mask(x, mask, inverse=FALSE, updatevalue=NA,
touches=TRUE, filename="", ...)
# S4 method for SpatVector,SpatVector
mask(x, mask, inverse=FALSE)
SpatRaster or SpatVector
SpatRaster or SpatVector
logical. If TRUE
, areas on mask that are _not_ the maskvalue
are masked
numeric. The value(s) in mask
that indicate which cells of x
should be masked (change their value to updatevalue
(default = NA
))
numeric. The value that masked cells should become (if they are not NA
)
logical. If TRUE
, all cells touched by lines or polygons will be masked, not just those on the line render path, or whose center point is within the polygon
character. Output filename
additional arguments for writing files as in writeRaster
SpatRaster