Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

navigator.geolocation.getCurrentPosition returning wrong results

When I use the geolocation service in the usual manner like for example :

if (navigator.geolocation) {
             navigator.geolocation.getCurrentPosition(showPosition1,errLocation, {maximumAge:0, timeout:40000, enableHighAccuracy:true});
            }
function showPosition1(position) {console.log(position.coords)}

I get a result which is extremely off. When I check using position.coord.accuracy, it shows to be 260 km! That is very far from where I am.

Any idea why this is the case even though highAccuracy is enabled and the browser permits location and everything?

I am using my mobile data's hotspot to connect to internet on my laptop. Can this be a big issue?

like image 822
user10078948 Avatar asked Jul 14 '18 05:07

user10078948


1 Answers

GeoLocation features use MANY different ways to figure out your location. In addition to the standard ways, Chrome at least one additional.

  • GPS co-ordinates -- If available, these are the most accurate.
  • Geo-IP -- Try to look up the IP address and find its location. This is known to be wildly inaccurate
  • (Chrome) Access Point Names -- The Google Maps van also collects Access Point (SSID) and their location. Chrome will use your current access point to try to find your location.

If your access point moved, it can throw off things. If you have to resort to Geo-IP, accuracy is a crap-shoot.

In addition, using proxy servers or VPNs will make Geo-IP useless.

like image 177
Jeremy J Starcher Avatar answered Nov 04 '22 22:11

Jeremy J Starcher