问题
I am getting coordinates with Windows Phone GeoWatcher like this
private GeoCoordinateWatcher _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High);
_watcher.MovementThreshold = 2; // Threshold Value
_watcher.PositionChanged += Watcher_PositionChanged; //Registering Watcher Position Change Event
_watcher.Start(); // Starting Watcher
//Watcher position Change Event
private void Watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)
{
var coord = new GeoCoordinate(Convert.ToDouble(e.Position.Location.Latitude.ToString("0.00000").Replace(",", ".")), Convert.ToDouble(e.Position.Location.Longitude.ToString("0.00000").Replace(",", ".")));
}
But I am getting different longitude and latitude values on same place even though I haven't moved and I have set the threshold value as well. If I am not wrong the threshold means if you cover at least that much distance then it will give you new coordinates. Due to different coordinate values for the same place when I am standing still my app was failed on distance check. Since it returns a non zero distance for two coordinates and in realality I did not move.
Here are my some readings captured whist remaining on the same spot. I have removed some 0 distance entries for better analysis.
Previous POint 31.49858, 74.36393 New Points 31.49858, 74.36393 distance 0
Previous POint 31.49858, 74.36393 New Points 31.49345, 74.36399 distance 570.95
Previous POint 31.49345, 74.36399 New Points 31.4935, 74.36195 distance 193.671
Previous POint 31.4935, 74.36195 New Points 31.4933, 74.36207 distance 25.002
Previous POint 31.4933, 74.36207 New Points 31.49324, 74.36264 distance 54.502
Previous POint 31.49324, 74.36264 New Points 31.49345, 74.36399 distance 130.226
Previous POint 31.49345, 74.36399 New Points 31.49355, 74.36227 distance 163.603
Previous POint 31.49352, 74.36229 New Points 31.49349, 74.36231 distance 3.840
Previous POint 31.49345, 74.36235 New Points 31.49343, 74.36238 distance 3.613
How I can get acheive accuracy in terms of distance if I'm not changing my position? It should not give me different coordinates.
回答1:
This shows a really bad GPS device. You get a jump of 570m, this should never be the case for GPS signals. Make sure that the location was got only from GPS (on android and ios if you do not care, positions may also come from cell Tower of wifi location service). Check also the timestamp of the first location, and compare it with system time, just to make sure it is not an old location which was cached.
It is normal for GPS when you are standing that coordinates move up to 30m. Therfore some smartphone manufacteres enables a "stand still" filter. It seems that you have to write your own "stand still" filter.
Simplest is to read the location.getSpeed(): if it is more then 5km/h take the position, otherwise ignore it. (This works well for vehicles but not for walking)
And also important, sittzing on your desk near a window you have the worst possible Gps signals. better go out for test.
回答2:
I think your Threshold setting is a "Red Herring". Your threshold of 2 means "don't report to me unless I move more than 2m from the previous reading." That is what you are seeing. The Threshold setting is not the issue or solution.
As AlexWien suggests you may not be getting location based just on GPS, to ensure GPS only you need to set the DesiredAccuracy property of your GeoCoordinateWatcher to High.
If the issue still persists (and it will but hopefully to a lesser extent) then I would suggest it is about the quality of the GPS fix. Perhaps you should check the HorizontalAccuracy and VerticalAccuracy values of the GeoCoordinate in the PostionChanged EventArgs.
A high value for these indicates a "poor" GPS fix (10 for example indicates the coordinate is +/-10m from the given value). Perhaps the phone can only see 3 satellites or the ones it sees are all in a similar patch of the sky. All these things degrade fix accuracy. If you want to track with high accuracy you should consider rejecting values with insufficent accuracy for your needs.
I Just captured logs from one of my GPS aware WP8 apps (in glorious Hull) and got this raw data:
time 05/02/2014 18:38:05 +00:00 spd 0.75 coords 53.7589650973678, -0.365797486156225 [err 21, 48]
time 05/02/2014 18:38:07 +00:00 spd 0.25 coords 53.7589640915394, -0.36607475951314 [err 10, 24]
time 05/02/2014 18:38:08 +00:00 spd 0 coords 53.7589303962886, -0.366103509441018 [err 10, 24]
time 05/02/2014 18:38:09 +00:00 spd 0 coords 53.7589660193771, -0.365918939933181 [err 11, 24]
time 05/02/2014 18:38:10 +00:00 spd 0 coords 53.7590100243688, -0.365963699296117 [err 16, 32]
As you can see whilst stationary I get accuracies in the 10-30m range and speeds in the 0-0.75mps range. Use this to filter out position updates that are just GPS noise.
来源:https://stackoverflow.com/questions/16977644/different-gps-location-reading-of-same-physical-location-on-windows-phone-geocoo