hypertidy / geodist

Ultra lightweight, ultra fast calculation of geo distances
https://hypertidy.github.io/geodist/
Other
95 stars 8 forks source link

Min/Max Feature #17

Closed marcosci closed 6 months ago

marcosci commented 6 years ago

Would it be a viable option there to search for min/max distances? You answered to a tweet of mine and showed geodist, the only problem with it was that it returns the full distance matrix.

If you have quite a large number of points this becomes rather soon a memory issue. Would it be possible to only store a single number in the loop (e.g. check via ifelse if bigger/smaller each iteration)? One could set this possibly as argument in geodist().

mpadge commented 6 years ago

Yeah, that would be entirely possible, and would be a nice enhancement. It'd likely be best written as a separate function for maximal efficiency. I'll let you know here when that's done

mpadge commented 6 years ago

Re-opened until the georange function has been documented in the vignette

marcosci commented 6 years ago

Neat :-) Just tested it, worked like a charm!

To add on that: would it be within the scope of geodist to also take a three column matrix and return min max for pairwise IDs (third column)? That is something we (landscape ecology) are always interested in and given the lightweight of geodist, the package would be a perfect drop-in replacement for a lot of otherwise large dependencies. :+1:

mpadge commented 6 years ago

So you mean that georange could or should also return the ID values corresponding to the min & max values? Yeah, that would obviously be useful. It would likely be more pragmatic to simply return the position and allow the user to map that back onto desired (ID) column, but that last step would be easy. Good idea - thanks!

mdsumner commented 6 years ago

I often go through that sequence when providing.metrics to animal tracking stuff, the q comes in "when was it nearest to X?" and then of course where was that, and how far ... so the distance provides the answer after tracing back . :)

mpadge commented 6 months ago

This is now all done via #31