Skip to content

patrickziegler/strava-heatmap-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

strava-heatmap-proxy

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:

  1. The strava-cookie-exporter browser extension to export the necessary cookies as json file
  2. 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.

🛠️ Build and Install

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 install

🚀 Usage

Export cookies via the strava-cookie-exporter browser extension

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 strava-cookie-exporter extension to export the relevant cookies as json file

The exported json file is needed for running strava-heatmap-proxy.

Run the strava-heatmap-proxy server locally

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 --target or --port as well.

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 --cookies as well.

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).

Configure your TMS client

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 in order to filter for certain activities or select different colorschemes, this page lists some more options for that.

And this is how the result might look like in QMapShack:

screenshot of tms client

References

  1. Discussion in bertt/wmts#2 revealed the meaning of CloudFront-* tokens
  2. https://github.com/erik/strava-heatmap-proxy was following a similar approach but is designed to be a Cloudflare worker

License

This project is licensed under the GPL - see the LICENSE file for details

About

Proxy server that provides easy access to the Strava high resolution global heatmap

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •