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
The 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.
Note
The exported cookies have an expiration period of 24 hours, but you'll most likely need to export them only once as the proxy will 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 months at least).
You can use the prebuilt Docker image for running a local instance of the proxy server in your terminal:
export LOCAL_PORT=9192 # optional, in case you want a different port than 8080 (the default)
docker run --pull=always --rm -p ${LOCAL_PORT:-8080}:8080 -v ${HOME}/.config/strava-heatmap-proxy:/home/nonroot/.config/strava-heatmap-proxy:ro docker.io/patrickziegler/strava-heatmap-proxy:latestAs a more simple alternative, you can use the provided docker-compose.yml:
export LOCAL_PORT=9192 # optional, see above
docker compose up -dThis 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.
By default, the necessary cookies are expected to be found in the file ${HOME}/.config/strava-heatmap-proxy/strava-cookies.json (as created with the strava-cookie-exporter extension).
To use this with your client 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/{z}/{x}/{y}.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 '["https://gpx.studio"]' option.
Otherwise the browser would reject the responses due to a violation of the same-origin policy.
With the option 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.
By default, strava-heatmap-proxy is configured to fetch tiles from the global heatmap. If you want your personal heatmap instead, you can run the proxy like this
strava-heatmap-proxy --target "https://personal-heatmaps-external.strava.com/tiles/<USER_ID>/"And then use the followng URL in your layer configuration
http://localhost:8080/bluered/{z}/{x}/{y}.png?missing=empty&filter_type=all&include_everyone=true&include_followers_only=true&include_only_me=true&respect_privacy_zones=false&include_commutes=falseWhereas the <USER_ID> is a unique identifier you can find out by using the developer tools while accessing the personal heatmap in your browser. We will make this field visible via the strava-cookie-exporter in a future release.
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
