Searches for connected patches (neighbouring cells of the same class i).
The 8-neighbours rule ('queen's case) or 4-neighbours rule (rook's case) is
used. Returns a list with raster. For each class the connected patches have
the value 1 - n. All cells not belonging to the class are NA
.
Landscape metrics rely on the delineation of patches. Hence, get_patches
is
heavily used in landscapemetrics. As raster can be quite big, the fact that
get_patches
creates a copy of the raster for each class in a landscape becomes
a burden for computer memory. Hence, the argument to_disk allows to
store the results of the connected labeling algorithm on disk. Furthermore,
this option can be set globally, so that every function that internally uses
get_patches
can make use of that.