does anyone know a gem / plugin / class with methods to do calculations
based on lat/lon coordinates? E.g. calculate the distance of 2 points on
the earth surface. I tried to implement my own stuff, which does not
quite give me exact results.
(quite a repost from a recent railsfrance ML thread, sorry for people subscribing to both lists)
Not specifically a gem for the moment, but you may find the information useful though.
Are you trying to compute bird-flight distances, or driving distances ?
for bird-flight distances:
if you have access to the Google API, you can rely on “distanceFrom”
if you don’t, you can rely on the Haversine formula (did you use this very one in your own implementation ?)
=> implementation example here :
for driving distances it’s more complicated (and google API doesn’t expose this functionaly AFAIK, although it’s available in maps.google.com
hope this helps