This software allows streaming high resolution Strava Global Heatmap tiles with clients like QGIS, QMapShack, JOSM and many others without requiring them to be able to handle the Strava specific authentication and session management.
To do so, you need the following two pieces:
- The strava-cookie-exporter browser extension to export the necessary cookies as json file
- The strava-heatmap-proxy server which adds the necessary cookies to your requests before redirecting them to Strava
Note: Previous versions of this repository were able to login to Strava automatically when running the proxy server. Due to recent changes on Strava side this is not possible anymore and we need to extract (at least) a valid session identifier via the browser extension. The proxy will then automatically refresh CloudFront tokens in case they have expired.
With git, golang and make available on your system, the following steps are sufficient to build and install strava-heatmap-proxy to the given path INSTALL_PREFIX:
git clone https://github.com/patrickziegler/strava-heatmap-proxy
cd strava-heatmap-proxy
INSTALL_PREFIX=~/.local/bin make installIn case you don't have these tools available, the Dockerfile allows to build a containerized version of the proxy server as well:
docker build -t strava-heatmap-proxy .
docker run --rm -p 8080:8080 -v ~/.config/strava-heatmap-proxy:/config:ro strava-heatmap-proxyAlternatively, you can download and execute a pre-built container image with the following command:
docker run --rm -p 8080:8080 -v ~/.config/strava-heatmap-proxy:/config:ro docker.io/patrickziegler/strava-heatmap-proxy:latestThe strava-cookie-exporter browser extension is available in the Firefox add-on store and the Chrome web store.
With this extension installed, you can:
- Use your browser to login and navigate to the Strava Global Heatmap
- Use the extension to export the relevant cookies as json file
The exported file is needed for running strava-heatmap-proxy.
Running the tool strava-heatmap-proxy from your terminal will set up a local proxy server for https://content-a.strava.com/.
Every request to http://localhost:8080/ will then be extended with session cookies before being forwarded to Strava.
You can configure different target URLs or port numbers via the --target or --port options.
By default, the necessary cookies are expected to be found in the file ${HOME}/.config/strava-heatmap-proxy/strava-cookies.json (should be manually created with the strava-cookie-exporter extension).
You can configure different locations of that file via the --cookies option.
The CloudFront cookies have an expiration period of 24 hours, but you don't need to recreate the strava-cookies.json file all the time because strava-heatmap-proxy can automatically refresh expired cookies as long as the session is valid (the exact duration of that is unkown right now, but it seems to be several weeks at least).
To use this with your GIS software of choice, just define a simple TMS layer like shown below that fetches high resolution heatmap tiles:
<TMS>
<Title>StravaGlobalHeatmap</Title>
<MinZoomLevel>5</MinZoomLevel>
<MaxZoomLevel>16</MaxZoomLevel>
<Layer idx="0">
<ServerUrl>http://localhost:8080/identified/globalheat/all/bluered/%1/%2/%3.png?v=19</ServerUrl>
</Layer>
</TMS>The ServerUrl can hold other elements than all and bluered. If you want to filter for certain activities or select different colorschemes you may check this page for how to set it up accordingly.
Web clients like gpx.studio need to be whitelisted via the --allow-origins option.
Otherwise the browser would reject the responses due to a violation of the same-origin policy.
strava-heatmap-proxy --allow-origins '["https://gpx.studio"]' --port 8080With that in place, you can add the custom layer http://localhost:8080/identified/globalheat/all/bluered/{z}/{x}/{y}.png?v=19 for accessing the heatmap.
And this is how the result might look like in QMapShack:
- Discussion in bertt/wmts#2 revealed the meaning of
CloudFront-*tokens - https://github.com/erik/strava-heatmap-proxy was following a similar approach but is designed to be a Cloudflare worker
This project is licensed under the GPL - see the LICENSE file for details
