Closed bniebuhr closed 2 years ago
Ok, it makes sense to keep a more broad integration to terra
to later on.
So, for now, I keep only the fast solution for buffer in the extract_covariates function.
I am just not sure how to come back with this now. Should I just change this amd make a new commit in my clone of the repo, then create a new PR? Or maybe i just need to make a new commit, without necessary new PR.... Sorry, I am not used to this formal workflows...
@jmsigner I have now solved the issue, and I kept only the minor changes regarding the additional arguments to use a buffer and removed all changes related to the use of terra
. It should be mergeable now, but tell me if there is anytthing else to change.
Hi @jmsigner , even though it seems some checks have failed, I guess it possible to merge that already... It would be useful to use it! =)
I will submit a new version to CRAN within the next few days. Thanks for your contribution
Hi!
In this PR I tried to do two things.
extract_covariates
, as requested in this issue. Basically I just added...
to the raster::extract call, so it is possible to use the argumentsbuffer
andfun
here. Seems to work, even though I am not sure if it is the best solution. I only implemented this for the baseextract_covariates
functions, for not the_along
andtime_var
ones which seem more complex (and I haven't used so far).Here a test:
SpatRast
format, as requested in this other issue. Seems to work, even though for the example of the deer in the package the time of the procedure does not change much (or may be even faster withraster
package).Here is the usage:
Here is a time comparison, but maybe this is not the best way of trying it:
Two remarks here: a. I only implemented this for the base function, not for
_along
andtime_var
yet. b. For theterra
extraction, there is nobuffer
argument, so the approach in 1. above will not work. We would have to think of another approach (e.g. having a buffer argument explicitly, then transforming the points on polygons, then extract).I added these examples above in the examples list for the time being, then we can remove it (or keep it minimal) when this is tested.
Hope this is useful, or at least the beginning of something useful.