GPS oscillating even when at a fixed location [closed]

1

I'm working on an Ionic app, with traceability, but the GPS signal oscillates very certain 200m, even though it's in a fixed place, do you know any solution to that?

    
asked by anonymous 06.06.2016 / 23:00

1 answer

2

The actual precision of a device depends on the chipset, the location where you are (in an enclosed space, tends to be more inaccurate), etc.

The typical accuracy of a handheld GPS device would be something like 30% of its measurements within 50 meters of the actual position (yes, the devices are inaccurate).

To try to minimize, you can take into account only the most precise positions!

Here's an example:

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

function success(pos) {
  var crd = pos.coords;
  if(crd.accuracy < 25){
      // usamos apenas as com presição menor que 25 metros
   }  
};

function error(err) {
  console.warn('ERROR(' + err.code + '): ' + err.message);
};

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

EDIT

enableHighAccuracy : The enableHighAccuracy attribute provides a hint that the application would like to receive the best results possible. This may result in slower response times or increased power consumption. The user may also deny this capability, or the device may not be able to provide more accurate results than if the flag was not specified. The intended purpose of this attribute is to allow applications to inform the implementation that they do not require high-precision geolocation fixes, and therefore the implementation may prevent the use of geolocation providers that consume a significant amount of power (eg, GPS ). This is especially useful for applications running on battery powered devices, such as mobile phones.

accuracy : This indicates the level of precision of the latitude and longitude coordinates. It is specified in meters and must be supported by all implementations. The value of the accuracy attribute must be a non-negative real number.

In the example above, we took only the coordinates with an accuracy of less than 25 meters. This means that it can be within a radius of 25 meters from this position.

Reference

    
29.09.2016 / 00:09