Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
> would it be possible to get the value Paris by looking up the non existent key of 672? Sure, add the non-existent key 672 pointing to Paris as nearest neighbor! :) Seriously, a one kilometer grid of distances on earth only means precalculating at most 20000 entries (but better use an array then). You can also go for a compromise and add a wider grid to the hash, like e.g. 10 kilometers. (The optimal width depends on your data). Now rounding 672 to 670 and 680 will lead you to precalculated hash entries pointing to Paris. Can't be much faster...
---The Perlman
In reply to Re: Lookup closest hash key
by The Perlman
|
|