Note that there are some explanatory texts on larger screens.

plurals
  1. POIs Google Maps calculating the wrong distance?
    text
    copied!<p>I've managed to get two functions working to calculate distances between two point on a google map. One that I gleaned(stole) from various places on the web and the other using the GLatLng.distanceFrom method in the Google Maps API. </p> <p>The reason I'm using two functions is because I noticed something odd about the results I was getting form Google, for example, the distance between Lands End and John O Groats in the UK is returned as follows</p> <ul> <li>My Function: 985km </li> <li>Google: 986km</li> <li>Wikipedia: 970km</li> </ul> <p>The 15/16km difference from the Wikipedia result is because Google return a location result about 15 km away from the actual John O Groats. So that's about right. </p> <p>So then I tested the distance between London and Milan and got</p> <ul> <li>My Function: 1232km </li> <li>Google: 1234km</li> <li>Wolfram Alpha: 958.5km</li> </ul> <p>So someone is more than 250km out. Then I tried London to New York</p> <ul> <li>My Function: 8244km </li> <li>Google: 8254km</li> <li>Wolfram Alpha: 5581km</li> </ul> <p>Generally, the distance between London and New York is thought to be around 5560km. But now both my function and the Google function appear to be way off the mark. </p> <p>The function I'm using <a href="http://pastebin.com/f7f835db7" rel="nofollow noreferrer">can be found here</a>. My Apologies to the author for not linking to the original site, but the layout is really confusing. I'm using the distHaversine function.</p> <p>I must admit, the maths is way beyond my comfort level, but I get the gist, and as I understand it, Google uses the Haversine method too. I also understand that it can be off by about 0.3%, but that wouldn't account for the differences I'm seeing. And I'm further confused by the fact that it's sometimes right on, and sometimes way off the commonly stated distances between places. It appears the greater the distance, the more off it is. </p> <p>So who's wrong. Google and the function I'm using, or everyone else?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload