Description Usage Arguments Details Value See Also Examples
View source: R/modify.operators.R
Blend two rasters simply by adding (and weighing) their values per cell.
1 |
obj |
[ |
overlay |
[ |
patches |
[ |
weight |
[ |
In case patches = TRUE
, the cells in the overlay are grouped
according to the foreground patches in the primary raster and all cells of
this group are assigned their common average, then the blend is carried
out.
A blend operation currently is defined as 'overlay*weight + obj'. To
aggregate more than two RasterLayers
with arbitrary functions, see
rReduce
.
A RasterLayer
of the same dimension as primary
, in
which an overlay has been blended with the primary raster.
Other operators to modify a raster: rReduce
,
rRescale
, rSegregate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # define primary raster ...
input <- rtRasters$continuous
patches <- rPatches(rBinarise(input, thresh = 30))
# ... and an overlay from a matrix
m <- matrix(nrow = 56, ncol = 60, data = 0)
m[c(5:25), c(5:50)] <- 10
mask <- raster::raster(m, xmn=0, xmx=60, ymn=0, ymx=56, crs=NA)
# blend while considering patches in the primary raster
blended <- rBlend(patches, overlay = mask, patches = TRUE)
visualise(raster::stack(patches, blended))
# blend while not considering patches
visualise(rBlend(patches, overlay = mask, weight = 10))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.