I’m creating an application which needs to determine if my current location (recd in didUpdateLocation:) is present among a set of geo-coordinates I have. Now I understand that comparing double/float values for equality can be error prone as the precisions involved in geo-coordinates is very high. Slight inaccuracy in the GPS can throw my algo off-track. Hence I need to compare it with some error margin.
How do I compare 2 CLLocations with a margin of error? Or determine the error in the location reading (I don’t think this is possible since CLLocationManager would have rectified it).
Thanks in advance 🙂
In each
CLLocationinstance there is a property declared as@property(readonly, nonatomic) CLLocationAccuracy horizontalAccuracy;What you can do is to make a routine like:You can make even more complex logic as both locations have that property…
Cheers.
【ツ】