Open AMBarbosa opened 2 years ago
Those examples are comparing the performance of exactextractr::exact_extract
to terra::extract
. I don't have any plans to add support for SpatVector
but would be happy to accept a contribution that does so.
My bad, I didn't notice some examples were with extract
and others with exact_extract
;) But minimal implementation could be something so simple as coercing to 'sf' at the beginning of the function:
if (inherits(y, "SpatVector")) y <- st_as_sf(y)
... and then adding "SpatVector" to the help file @param y
I've been on the fence about that, because I'm wary of silently copying the full input dataset. But I guess it's no different than what I'm doing to "support" sp
types. Do you think a warning would be appropriate, or is it just not that big a deal for most users?
I don't think it is warning-worth, but it might indeed be a good idea to mention in the help file @param y
that 'Spatial*' and 'SpatVector' inputs will be converted to 'sf'.
I am not sure if it's now possible to do exact_extract(rast,vect,fun=sum) ?
I am not sure if it's now possible to do exact_extract(rast,vect,fun=sum) ?
You would need to do exact_extract(rast, st_as_sf(vect), fun = 'sum')
.
Hi, here you present a couple of examples using a "SpatVector" (brazil_spat) as input, but when I try that myself, I get _Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘exactextract’ for signature ‘"SpatRaster", "SpatVector" (both with the CRAN and with the GitHub version of 'exactextractr'). Will the "SpatVector" implementation become available soon? It will be really useful! Cheers