geodist icon indicating copy to clipboard operation
geodist copied to clipboard

Min/Max Feature

Open marcosci opened this issue 6 years ago • 5 comments

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().

marcosci avatar Jul 26 '18 12:07 marcosci

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 avatar Jul 27 '18 07:07 mpadge

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

mpadge avatar Jul 27 '18 17:07 mpadge

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:

marcosci avatar Jul 31 '18 06:07 marcosci

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!

mpadge avatar Jul 31 '18 09:07 mpadge

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 . :)

mdsumner avatar Jul 31 '18 11:07 mdsumner