I have 4 raster layers contained in a raster stack and want to generate polygons that encompass all cells of a specified value.
The raster
package can be use to generate an example data set.
library(raster)
filename <- system.file("external/test.grd", package="raster")
r <- raster(filename)
Like the raster below, my real data are akin to maps of animal habitat and have a patchy distribution of 'good' and 'bad' areas.
To more closely mirror my real data, we can then add a bit of variation to three other rasters and make a stack.
s <- stack(r, r+250, r-250, r+100)
Working with the stack s
is it possible to create polygons that surround all cells less than 300 in all stack layers?
As an extension, my end goal is to then calculate the area (or percent) overlap between the resulting polygons.
Any suggestions (specific or general) would be greatly appreciated.