P
P
Petr Volkhanov2017-07-16 20:25:22
JavaScript
Petr Volkhanov, 2017-07-16 20:25:22

How to accurately determine the user's location?

Good afternoon!
I'm using code like this to get user's location:

var options = {
  			enableHighAccuracy: true,
  			timeout: 5000,
  			maximumAge: 0
    };

    function success(pos) {
      var crd = pos.coords;

      console.log('Your current position is:');
      console.log(`Latitude : ${crd.latitude}`);
      console.log(`Longitude: ${crd.longitude}`);
      console.log(`More or less ${crd.accuracy} meters.`);
    };

    function error(err) {
      console.warn(`ERROR(${err.code}): ${err.message}`);
    };

    navigator.geolocation.getCurrentPosition(success, error, options);

However, it does not quite accurately determine even my own location (an error of about 10 km). Although when I go to some sites, I see that they determine the address almost exactly (error up to 100 meters). How do they do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sim3x, 2017-07-16
@sim3x

They pay a lot of money for this and collect a lot of information from a bunch of sources.

B
Boris Korobkov, 2017-07-16
@BorisKorobkov

A computer connected via ethernet can only be identified by IP, and this is accurate to the city, maximum area.
A smartphone (with the permission of the user) is determined much more accurately using cell tower triangulation ( LBS ) or GPS. Especially cool companies can accurately determine the location by the names of WiFi networks or other indirect signs.
PS By the way, please indicate the sites that allegedly determine my location up to 100 meters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question