Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unbelievably inaccurate GPS points. What is the reason?

I have developed an application for Android, for storing user's GPS location.

One of my customers gave me his device and I noticed that sometimes the accuracy of the device is really bad and unbelievable. Sometimes the device returns points about 200 kilometers away from the actual location.

You can see this in the following GPS location samples for that device. You see that two points are about 200 km away from the real location.

The device is Samsung SM-T111 with Android 4.2.2, and I only use a GPS provider for getting locations (LocationManager.GPS_PROVIDER).

I want to know what causes the problem, for this kind of inaccuracy?

I directly store the points received from the provider. This is my code in onLocationChanged:

UPDATE

        @Override
        public void onLocationChanged(Location location) {
            try {

                    if (location.getAccuracy() <= MAX_DISTANCE_TOLERANCE) {

                        gotLocation(new GPSLocation(location.getLatitude(),
                                location.getLongitude(), location.getTime(),
                                location.getAccuracy(),
                                location.getProvider(), location.getSpeed()));
                    }               

            } catch (Exception e) {
                MessageBox.showExceptionToast(_context, e);
            }
        }

enter image description here

enter image description here

like image 619
Bobs Avatar asked Nov 06 '16 07:11

Bobs


1 Answers

I want to know what can be the problem for this kind of inaccuracy?

Hardware/firmware, most likely. In other words, blame Samsung.

It's unlikely to be your app. Assuming that the accuracy values that you are getting for those failed points are within MAX_DISTANCE_TOLERANCE, and assuming that MAX_DISTANCE_TOLERANCE is less than 200km, you are faithfully using the data that you get. If that data is flawed, those flaws are coming from the system itself.

You could create a more adaptive filter. In addition to testing the accuracy for MAX_DISTANCE_TOLERANCE, you could:

  • Calculate the time between the last location you were given and the new one that you are processing now
  • Calculate the maximum distance that could be covered in that time, based on some maximum speed that you expect the device to be going
  • Calculate the distance reported between those two locations (there's a static method on Location for this)
  • Reject locations where the reported distance is further than you think the device could have moved in this period of time

For example, your first bad fix comes 20 minutes after the previous one. Unless you think the device might travel at 600 km/hour, you would reject the bad fix as being unrealistic.

This algorithm will only work after you have a few consistent fixes. You might ask for rapid location updates for a few minutes, examine that data, throw out any outliers, then apply the "could the device really have travelled that far?" test for future fixes.

like image 154
CommonsWare Avatar answered Oct 22 '22 12:10

CommonsWare