rspatial / terra

R package for spatial data handling https://rspatial.github.io/terra/reference/terra-package.html
GNU General Public License v3.0
532 stars 86 forks source link

distance function: allow return of raster values as well as distances #1243

Open SimonDedman opened 1 year ago

SimonDedman commented 1 year ago

Per this thread and the comments on the answer, it would be great to be able to specify if you also want to return the values of the nearest pixels in the target raster, rather than just the distance to those pixels.

Indeed in my current case, IDK that I need the distance at all, I just need points which are within 200m of the raster to get the nearest raster pixel's value appended - I don't subsequently care how far the donor pixel was (so long as it was <200m).

Not sure whether this would be a staggering amount of work, or conversely, once the code is at the point of having calculated the nearest pixel, it'd simply be a case of using that index to grab the required value(s).

Cheers for considering this regardless.

ratnanil commented 1 month ago

That would be a life savoir... Are there any plans to implement something along these lines?