Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Google Maps calculating the wrong distance?

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.

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

  • My Function: 985km
  • Google: 986km
  • Wikipedia: 970km

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.

So then I tested the distance between London and Milan and got

  • My Function: 1232km
  • Google: 1234km
  • Wolfram Alpha: 958.5km

So someone is more than 250km out. Then I tried London to New York

  • My Function: 8244km
  • Google: 8254km
  • Wolfram Alpha: 5581km

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.

The function I'm using can be found here. My Apologies to the author for not linking to the original site, but the layout is really confusing. I'm using the distHaversine function.

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.

So who's wrong. Google and the function I'm using, or everyone else?

like image 522
gargantuan Avatar asked Jun 30 '09 00:06

gargantuan


People also ask

Is Google Maps distance measuring accurate?

Google has all that is required to calculate a distance to 100% accuracy. You have a Map to a scale that is 100% accuracy,presumably. You have a user defined route with waymarks and more than enough computing power to calculate the distances between the waymarks to 100% accuracy based on the scale you have.

Can Google Maps tracking be wrong?

GPS: Maps uses satellites to know your location up to around 20 meters. When you're inside buildings or underground, the GPS is sometimes inaccurate. Wi-Fi: The location of nearby Wi-Fi networks helps Maps know where you are. Cell tower: Your connection to mobile data can be accurate up to a few thousand meters.


2 Answers

Google Maps doesn't calculate the shortest straight distance -- it goes by roads and (air, water, ?)

like image 120
Sam Avatar answered Sep 30 '22 12:09

Sam


As it turns out, I had the latitude and longitude parameters the wrong way around.

like image 26
gargantuan Avatar answered Sep 30 '22 12:09

gargantuan