Android - How Can I Calculate The Cumulative Distance With Gps
Solution 1:
There's a couple of ways to do this. One is to drop small movements. If you get a location update and the distance moved is less than R, ignore it. As R gets bigger you'll completely eliminate noise, but may eliminate real moves smaller than R as well. You can figure out an R that's good enough for your problem based on trial and error.
Another way would be to do something like a Kalman filter, which treats your position as a probability function. But that gets into a lot of complicated math, and has some of the same problems as the drop approach.
Another method would be to combine the data with accelerometer data to determine if you've actually started moving. Google does this in its activity detection code. The goal here would be to determine when you start and stop moving by seeing acceleromaeter spikes, and ignore small movements if not preceeded by a spike (include large movements still as that may be motion at a constant velocity).
Nothing will give you 100% accuracy of course. But you should be able to get pretty good results from these techniques.
Post a Comment for "Android - How Can I Calculate The Cumulative Distance With Gps"