views:

77

answers:

3

i've a gps tracker that now works great, except when iphone lost gps connection. When the connection is lost the track make one or more point to a random location (as you can see in this image:

track

In which way i can discard this bad values? I've think to do in this way: before save my data i can do a sum of my integer values of current latitude and longitude and compare with integer values of my old latutude and longitude; if the difference is > somevalue i discard my data.

It will be a good thing? There's some other nice tricks to do this?

Thank's

A: 

Try to check the time of the location update while the GPS has no signal (the time is provided within the location parameter if I recall correctly).

Maybe the time is some constant , and that way you can check if the difference between the current time and the location time is more then some value, to know if the location is real or not.

Idan
mhmmmm i just check this parameter when locationManager:didUpdateToLocation:fromLocation:is call, if a bad value i discard it in this way
zebra
So, you got it fixed ? if so please check my answer as the accepted one.
Idan
nono, is not fixed. i just check timestamp in this way (is the first thing i do in that delegate method).
zebra
can you post to code to show me how you do it ?
Idan
zebra
A: 

You can sanity check points before using them. If the accuracy level suddenly jumps up and then back down again, you can throw away that one point. If the timestamp says the user is suddenly moving at supersonic speeds to get to the new location after calculating the distance over time from any previous points, then the point is likely bogus. etc.

hotpaw2
A: 

maybe i've found my fault:

in

locationManager:didFailWithError:

when i receive a kCLErrorNetwork or any other error except kCLErrorDenied i perform a stopupdatinglocation and a startupdatinglocation.

Now the app works good, i make some other test tomorrow and post here the result.

zebra
my fault was stopping and starting locationmanager on any error, now tracks are very accurate!
zebra