user377312
user377312

Reputation: 29

Is there a way to reliably prevent CoreLocation-coordinates from being snapped to nearby roads?

An iOS-app I've been working on requires accurate coordinates to record the location of a moving vehicle. While I've been able to get it to work fairly well in general, the data I get from the CoreLocation service seems to occasionally snap to nearby roads, which is something I'd very much like to prevent from happening.

Looking around a bit on this issue, I've mainly found suggestions regarding the ActivityType and DesiredAccuracy configured for the LocationManager, but setting those to 'OtherNavigation' and 'Best' respectively, as was suggested most often, hasn't seemed to do the trick so far. Other ActivityTypes that have been suggested (Fitness, Other) haven't seemed to have any effect either.

Is there any way to reliably make sure I get the actual coordinates, without them being 'corrected' and snapped to nearby roads?

An example:

I tracked my location with a different tool, giving me accurate GPS logs: enter image description here

But the data I received in my app snapped to the road eventually:

enter image description here

The fact that the coordinates I received seem to be exactly on a straight line makes me think the GPS is accurate enough, but it's just being corrected towards the single road that Apple Maps shows for this location:

enter image description here

Upvotes: 1

Views: 149

Answers (1)

user377312
user377312

Reputation: 29

I figured this out eventually. I had created an instance of CLLocationManager in my AppDelegate where I set up its different configuration-options, but I was taking my data from a different instance of CLLocationManager, created somewhere else. This instance was still using the default .other ActivityType. After configuring it to use .otherNavigation instead, the road-snapping behavior went away.

Upvotes: 1

Related Questions