Classifies GPS tracks from OwnTracks (iPhone) into walking segments and builds a master GeoJSON file you can load into any map viewer.
- OwnTracks exports GPX files to iCloud Drive.
- iCloud Drive syncs to WSL at a path like
/mnt/c/Users/YourName/iCloud Drive/GPX-Tracks/. pipeline.pyscans that folder, runs each new file through the classifier, and appends walking segments towalks.geojson.
Each track is filtered and split before classification:
- Accuracy filter — points with GPS accuracy worse than 25 m are dropped.
- Gap splitting — a pause of more than 5 minutes starts a new segment.
- Speed splitting — 3+ consecutive intervals above 7 km/h are carved out as their own (non-walking) segment.
A segment is labelled walking if:
- ≥ 65% of 5-point rolling windows have an average speed between 0.3 and 7 km/h, and
- path coherence (straight-line displacement ÷ total path length) is ≥ 0.5.
pip install gpxpypython pipeline.py "/mnt/c/Users/YourName/iCloud Drive/GPX-Tracks"Run this whenever new GPX files have synced. Already-processed files are recorded in processed.json so re-runs are safe.
| File | Description |
|---|---|
walks.geojson |
GeoJSON FeatureCollection of walking LineString features, each with start_time and end_time properties. |
processed.json |
List of GPX filenames already ingested — do not delete this or files will be reprocessed. |
Both files are written to whichever directory you run the script from.
from classifier import classify_track
points = [
{"lat": 43.47, "lon": -80.54, "time": datetime(...), "accuracy": 8.0},
...
]
segments = classify_track(points)
for seg in segments:
if seg.is_walking:
print(f"Walk: {len(seg.points)} points")