17.9 · Cleaning location fixes, choosing geofences, and map geometry

Location data is noisy and the map is a projection; both facts decide whether your feature feels precise or flaky.

Mental model. Treat every fix as a claim with an accuracy and an age, monitor only the regions that matter now, and remember map distances are projected.

Fixes and regions

Filtering a stream and living within 20 regions.

  1. How do you filter a stream of location fixes: accuracy, age, and implausible jumps? 17.9.1 · L3
    Every CLLocation has a horizontalAccuracy (radius in metres, negative means invalid), a timestamp, and optional speed and course (also -1 when unknown). The…
  2. How do you geofence 500 stores when an app may monitor only 20 regions at a time? 17.9.2 · L5
    Monitor a sliding window: keep the 20 nearest candidates registered, and when the user moves (a significant-change wake-up, or a boundary crossing of a larger…

The map plane

Points, rects, spans and the date line.

  1. How does MapKit’s projected plane behave: map points, metres at different latitudes, and why a rect across the date line is wrong? 17.9.3 · L5
    MapKit works on a Mercator-like plane of 268,435,456 × 268,435,456 map points covering the world. One metre is a different number of points at each latitude…

More in System frameworks