Python script to reproduce the Strava Global Heatmap (www.strava.com/heatmap) with local GPX files
Optimized for cycling activities 🚴
- Minimal Python dependencies (
numpy
+matplotlib
) - Fast (parse 3x faster than
gpxpy.parse
)
- Download your GPX files to the
gpx
folder (https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export) - Install the python dependencies from
requirements.txt
- Run
python strava_local_heatmap.py
usage: strava_local_heatmap.py [-h] [--dir DIR] [--filter FILTER] [--year YEAR [YEAR ...]]
[--bounds BOUND BOUND BOUND BOUND] [--output OUTPUT] [--zoom ZOOM] [--sigma SIGMA]
[--orange] [--csv]
optional arguments:
-h, --help show this help message and exit
--dir DIR GPX files directory (default: gpx)
--filter FILTER GPX files glob filter (default: *.gpx)
--year YEAR [YEAR ...]
GPX files year(s) filter (default: all)
--bounds BOUND BOUND BOUND BOUND
heatmap bounding box as lat_min, lat_max, lon_min, lon_max (default: -90 +90 -180 +180)
--output OUTPUT heatmap name (default: heatmap.png)
--zoom ZOOM heatmap zoom level 0-19 or -1 for auto (default: -1)
--sigma SIGMA heatmap Gaussian kernel sigma in pixel (default: 1)
--orange not a heatmap...
--csv also save the heatmap data to a CSV file
Note: ZOOM
is OpenStreetMap zoom level (the number following map=
in www.openstreetmap.org/#map=)
On the use of histogram equalization: https://medium.com/strava-engineering/the-global-heatmap-now-6x-hotter
command | output |
---|---|
strava_local_heatmap.py |
|
strava_local_heatmap.py --orange |
|
strava_local_heatmap.py --csv |
See https://umap.openstreetmap.fr/en/map/demo-heatmap_261644 (by @badele) |
Arch Linux: sudo pacman -S tk
(see here)