Skip to content

remisalmon/Strava-local-heatmap

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
gpx
 
 
 
 
 
 
 
 
 
 

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)

Requirements

python>=3.9
numpy>=1.20
matplotlib>=3.4

Other requirements

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

Projects using strava_local_heatmap.py

JeSuisUnDesDeux

About

Python script to generate a high resolution heatmap from Strava GPX files

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages