I have the following code below which seems to be working fine:
// GPS Reader // Criteria Criteria criteria = new Criteria(); //criteria.setAccuracy(Criteria.ACCURACY_COARSE); // Used when we can't get a GPS Fix criteria.setAccuracy(Criteria.ACCURACY_FINE); // Used when we can get a GPS Fix criteria.setAltitudeRequired(false); criteria.setBearingRequired(false); criteria.setCostAllowed(true); criteria.setPowerRequirement(Criteria.POWER_LOW); LocationListener locationListener = new MyLocationListener(); LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); lm.requestLocationUpdates(lm.getBestProvider(criteria, true), 0, 0, locationListener);
However, when I graph the data I have collected on Google maps, the GPS coordinates are very scattered in some instances, or it will be going along a path I am walking just find and then all of the sudden jump to a point a mile away and then back. Is there any way to fix this? Some sort of accuracy check I guess?
Update:
Basically my problem looks like this as an example – GPS Jitter
Update 2:
I considered not making this a bounty but I figured I might as well get a complete understanding of what is going on here, and see if maybe my approach is over kill. I still have the same problem that my coordinates have jitter in them despite the fact that I have accuracies of 3m, etc. Now this could be to available satellites, etc. I don’t know, but basically I’m trying to understand how are all these other applications, especially the exercise apps, able to get such smooth readings under the same circumstances.
I was on Quora and was able to find this Does any running app have a feature of filtering GPS data to get more accurate tracking? Unfortunately it didn’t give much insight into my problem, except you can use a Kalman filter if you want, but surely there has to be less complex means, since I doubt most apps out there are implementing this.
Anyways if a fellow developer would like to share what they are doing with some pseudocode that would be greatly appreciated. I mean if I’m stuck with Kalman I am, but I am sure there have to be easier to implement algorithms, and would hope to learn those and how to implement them, that are decent fits.
Context: This is a mobile pedestrian application.
Relevant SO Questions I have tried to glean information from
Create a smooth curve from a series of GPS coordinates
Smooth gps data : This was a good start, though I am not sure what pseudocode I would need to implement to properly get the Least Squares Fit to work appropriately so that I will have a splines GPS data which I can then view on something like google maps to confirm I did it correctly. I think the issue is if this was general X and Y data I was dealing with, and not GEO coordinates, I could write something up in matlab test it, and go on.
Update 3
An image of the messed up GPS data I am recieving
https://www.dropbox.com/s/ilsf8snao2no65e/gpsdata2.png
What you are getting is because your criteria identifies best provider as
NETWORK_PROVIDER.Which does not identify your location but instead gives you the location of the cell tower whose range covers your device.So when you are outside of any building it is better to use
GPS_PROVIDERto get fine accuracy of Geo locations.Why you get scattered co-ordinate is because your device comes to range of another cell tower hence location jump happens. Directly useGPS_PROVIDERis the best solution you will ever get.