Skip to content

Instantly share code, notes, and snippets.

@fiddyschmitt
Last active February 2, 2025 19:01
Show Gist options
  • Save fiddyschmitt/4888003d78f07881f3854f627c5321cc to your computer and use it in GitHub Desktop.
Save fiddyschmitt/4888003d78f07881f3854f627c5321cc to your computer and use it in GitHub Desktop.
Strava Heatmap to KML
Install QGIS
Layer -> Add Layer -> XYZ Layer -> New
URL:
https://heatmap-external-b.strava.com/tiles-auth/run/hot/{z}/{x}/{y}.png?Key-Pair-Id=VALUE&Policy=VALUE&Signature=VALUE
Get the three VALUEs above by logging into Strava and inspecting the site cookies (F12 in Chrome or Firefox).
Max Zoom Level: 23
Click 'Add'
//Can't get the following step to work for generating a KML, even after installing the KML Tools Plugin
In the Layers section, right-click the Layer -> Export\
//Use the following instead
Project -> Import/Export -> Export Map to Image -> Png
Using GIMP, give it transparency (Layer -> Transparency -> Color to Alpha)
Export to PNG
Use this page to convert EPSG:3857 to lat/long
https://epsg.io/transform#s_srs=3857&t_srs=4326&x=18918596.3704000&y=-5406089.8623000
Populate the values in strava_heatmap.kml
Fill out the png filename & coords
Open with Google Earth, and export to KMZ
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.1">
<Document>
<name>Strava Heatmap</name>
<LookAt><longitude><%= lon %></longitude><latitude><%= lat %></latitude><range>1000</range></LookAt>
<GroundOverlay>
<drawOrder>0</drawOrder>
<Icon>
<href>strava.png</href>
</Icon>
<LatLonBox>
<north><%= north %></north>
<west><%= west %></west>
<south><%= south %></south>
<east><%= east %></east>
<rotation>0</rotation>
</LatLonBox>
</GroundOverlay>
</Document>
</kml>
@Seandebasti
Copy link

really helpful for your usecase!! I had trouble with -b instead of -{switch:a,b,c} and {z} instead of {zoom}. Thanks!!

@fiddyschmitt
Copy link
Author

:D thanks Sean

@kesterharris
Copy link

I know absolutely nothing about code, but following your instructions in [Strava Heatmap to KML.txt] was able to get a Strava World Heatmap into Google Earth. Thank you so much, this really helps me.
There's one step that's not working great for me: when I
Project -> Import/Export -> Export Map to Image -> Png
it works perfectly if I set Scale=1:25,000 115dpi, or Scale=1:25,000 230dpi, or Scale=1:50,000 115dpi, or Scale=1:50,000 230dpi
but any larger scale (eg 1:10,000, or 1:6250) it creates the png, but the png file is small (50kB) and has nothing visible. Any hints?
I have tried changing folder path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment