I want to extract from a RasterLayer
all boundary cells between classes (possibly according to the 4-cell rule), excluding from this operation cells that neighbour NA cells
The raster::boundaries
function detects boundaries as cells that have more than one class (including NA) cells in the 4 or 8 cells surrounding it , or, if classes
argument is set to FALSE
, cells with values and cells with NA.
What about if I do not want to consider as edge the NA border?