Stop detection

Where Is Tereza? identifies named stops along your route — the viewpoint where you sat for an hour, the café where you had lunch, the hostel where you slept. Each stop has a centroid (lat/lng), a duration, and a category (rest, sleep, viewpoint).

Two-pass algorithm

Pass 1 — Time-gap detection. Walk the GPS stream point by point. If two adjacent points are more than T_gap apart in time AND less than R_gap apart in space, treat the gap as a "silent stop" — the user wasn't moving but their phone wasn't publishing either. Defaults: T_gap = 5 min, R_gap = 30 m.

Pass 2 — Rolling-centroid clustering. For points that ARE publishing, walk a sliding window of width T_window (default 10 min). If the maximum distance from any point in the window to the window centroid stays under R_cluster (default 30 m) for the full window duration, that's a stop. Output the centroid + the timespan.

Pseudo-code for Pass 2:

window = []
for each point p:
  window.append(p)
  drop points older than (p.t - T_window)
  c = centroid(window)
  if max(haversine(q, c) for q in window) > R_cluster:
    if window.duration > T_window:
      emit_stop(c, window.start, window.end)
    window = [p]

Stop types

After both passes, each stop is classified by overall context:

Type Condition
Sleep Duration ≥ 6 hours AND straddles local midnight
Rest Duration 30 min – 6 hours
Viewpoint Duration 5 – 30 min, AND the trip is mostly walking/running
Pause Duration < 5 min — kept internally, not surfaced as a "stop"

Why two passes

Pass 1 alone misses stops where you DID publish but barely moved (GPS jitter at a viewpoint looks like a 30-m wandering walk to a one-pass time-gap detector). Pass 2 alone misses true silent stops (overnight at a hostel where you turned the phone off). Together they cover both regimes.

Tuning

The four parameters (T_gap, R_gap, T_window, R_cluster) are exposed in the org's config so you can tighten or loosen them per traveler style:

  • Long-distance walkers: defaults are fine.
  • Cyclists: tighten R_cluster to 15 m (you don't usually loiter on a bike).
  • Multi-day road trippers: loosen R_gap to 100 m so a parking lot isn't broken into multiple stops.

Need help? Contact support · Where Is Tereza?