Android Maps GPS outlier

2019-08-13 03:57发布

问题:

Using the Android maps api I'm creating polygons as I collect location data from every third point. The polygons track my position fairly well.

Problem is: Frequently the GPS returns points that are not remotely close especially when working around obstacles.

How can I filter my location data for outliers?

回答1:

Yes GPS has a hard time with especially around obstacles. Powerlines, buildings, etc. Simply filter them out.

@Override
public void onLocationChanged(Location location) {
        if (!location.hasAccuracy()) {
            return;
        }
        if (location.getAccuracy() > 10) {
            //possibly tell user gps accuracy with transparent circle like the maps 
            //application does.
            return;
        }

//process location accurate to 10 meters here
}