Description Usage Arguments Details Value See Also Examples
View source: R/modify.operators.R
Select cells of a raster based on a mask
1 |
obj |
[ |
mask |
[ |
background |
[ |
If used in an algorithm, mask
can also contain the name of a
sub-algorithm to use the final output thereof as mask. Moreover, mask
= "input"
would select the original raster as mask.
A RasterLayer
of the same dimensions as obj
, in which
all cells with value 0 in the mask have been set to NA
and all other
values are retained.
Other operators to select a subset of cells: rBounded
,
rGreater
, rLess
,
rMatch
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | input <- rtRasters$continuous
m <- matrix(nrow = 56, ncol = 60, data = 0)
m[c(5:25), c(5:50)] <- 1
visualise(rMask(input, mask = m))
## Not run:
# determine mask interactively
mask <- geomPolygon(template = input, vertices = 5, show = T, col = "deeppink")
mask <- gToRaster(mask)
visualise(raster = rMask(obj = input, mask = mask))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.