GPS Accuracy problem
w开发者_如何学Gohat the factors effect my GPS accuracy ? i'm using android gps so how can i solve the problem of the accuracy because i'm doing a real life game depend on the GPS so its seems to be hell to me this un accuracy
None of the sensors are accurate by themselves, and there are too many real world factors to tell which may be the most accurate.
Nonetheless, I've implemented a weighted average of each sensor, weighted by both recency and claimed accuracy:
- Track the last location fix for each LocationProvider individually. I use a
Map
of eachLocationProvider
name to the correspondingLocation
object. - On each update compute a new weighted average from the set of most recent fixes:
- Throw out any fixes older than some age threshold (say, 20 minutes)
- Calculate the weight of the remaining based on the inverse of each fixes' accuracy.
- To prevent discontinuities, depreciate weight location fixes less than some lesser threshold (say, 10 minutes) down to zero at first threshold.
- Sum weights, and calculate the percentage of each weight as it related to the total.
- Sum each latitude as weight_percent*fix.getLatitude(). Repeat for longitude.
- Create a new
Location
object with artificial LocationProvider name "average" and computedlat
/lon
to use through out the rest of your program.
Also, see the following: http://developer.android.com/guide/topics/location/obtaining-user-location.html#BestEstimate
精彩评论