Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 2.48 KB

README.md

File metadata and controls

58 lines (41 loc) · 2.48 KB

strava_local_heatmap.py

Python script to reproduce the Strava Global Heatmap (www.strava.com/heatmap) with local GPX files

Optimized for cycling activities 🚴

Features

  • Minimal Python dependencies (numpy+matplotlib)
  • Fast (parse 3x faster than gpxpy.parse)

Usage

Command-line options

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

Examples

command output
strava_local_heatmap.py heatmap.png
strava_local_heatmap.py --orange orange.png
strava_local_heatmap.py --csv See https://umap.openstreetmap.fr/en/map/demo-heatmap_261644 (by @badele)

Projects using strava_local_heatmap.py

JeSuisUnDesDeux

Troubleshooting

Arch Linux: sudo pacman -S tk (see here)