Adding patches ids
Nowosad opened this issue · 7 comments
Hi @mhesselbarth and @bitbacchus -- do we have a better way to get a raster with the patches ids than the one below?
library(landscapemetrics)
library(raster)
#> Loading required package: sp
plot(landscape)
patchdata = get_patches(landscape, return_raster = TRUE)
patchdata = stack(patchdata[[1]])
patchdata = merge(patchdata)
plot(patchdata)
Created on 2022-05-13 by the reprex package (v2.0.1)
(related issue -- #134)
I don' think so. But, I also think the way you showed is pretty easy and straightforward?
a small function wouldn't hurt, though...
But get_patches
is just one function? The following next lines are just needed to handle the resulting list
object because of our very strict type-stable approach
No, I think its not just handling the ˋlistˋ object, its rather the stacking and merging of the raster objects within the list. Not sure how often this is needed, however
Thanks for the answer and discussion, guys. I asked this question, because I was not sure if I missed some existing function. I think, for now, the solution in my first message could be enough for other people looking for the solution.
(Especially that this patch numbering is only available in the package dev version. @mhesselbarth do you have any plans to push this version to CRAN?)
If sombody wants to write a wrapper function around it, I am not opposing it btw. I just don't think it's really necessaire personally.
I can update the package soonish yes. I just have so much to do at the moment.
👍🏻