Re: Best way to...
- Posted by irv Oct 17, 2010
- 1793 views
Might be a bit more to it than that: for example, Montreal and Venice, IT are at almost the same latitude, but nowhere near close to each other in longitude.
So it could well turn out that the 3 closest (or the n closest) in one coordinate might not have any overlap with the 3 (or n) closest in the other coordinate.
How big is n?
The formula for computing distance between 2 points:
d=2*asin(sqrt((sin((lat1-lat2)/2))^2 + cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))
I could compute all 25k distances, but perhaps there's an easier way? Hashing lat/lon perhaps?