HKWorkoutRouteBuilder and CLLocationManager only adding route updates in increments
Solution 1:
It's not clear from your question if these are foreground or background updates, but given the gaps that also seem to come with a regular frequency, I suspect you're primarily getting background location updates.
You've already got the activityType
set to .fitness
, which I believe gives the highest resolution, but in any case iOS still periodically sleeps the location manager to preserve energy.
Since you're collecting what you expect to be a more-or-less-constant movement scenario, it would also be a good idea to set pausesLocationUpdatesAutomatically
to false
- explicitly controlling the CLManager's operation with the start and stop of the fitness/run scenario. That will chew through more battery, but should give you more consistent updates.
You will still likely have some gaps and probably the best solution will be to interpolate route positions between those gaps based on the timestamp of when you received them. In some dense urban areas, you may also need or want to smooth or otherwise constrain the route points, as I've found it's "easy" to get a route position of walking through a building instead of showing the street or sidewalk you're walking on. I haven't seen that issue nearly as much in places with more open skylines and lower buildings.