Visualizing running routes with Matlab and garmin-connect-export

Introduction

I’ve had a Garmin running watch (Forerunner 620, great watch!) for quite a while and ran a lot with that watch. Sadly, Garmin Connect is lacking an “export all” feature for your runs. We will use garmin-connect-export to download all our runs and visualize them with Matlab to obtain a heatmap-like summary of the most frequent routes we’ve been running.

Getting the data with garmin-connect-export

First download garmin-connect-export by kjkjava from Github.

Exporting all data is very easy. Just enter your username and password. A detailed tutorial is available at the Github page. You use the tool via

This way you get the last 1000 activities saved into a folder MyActivities. If you have more runs than 1000, just increase the number. Make sure to insert your username and password correctly. Exporting may take a while, go get a coffee.

Analyzing and visualizing with Matlab

Now assuming you have all the data, let us use them.
I have ~1800 files downloaded and the fastest way to use the data was to save it as a struct in Matlab first. Therefore, let us read all files, import them and store. We then save the struct so we do not have to redo the procedure again. Instead you can just load the struct you have just saved the next time.

Make sure to insert the right folder in the first line. Again, this step takes a while. But you only need to do it once.
In a next step, let’s plot all these routes.

At first it looks like this

but zooming in on the city of Aachen helps.


The reason why the initial plot looks so terrible is because I did some running in Asia too, thus making it impossible to see such small scale events as local runs.
Now a run is just a sequence of gps coordinates, i.e. (x,y) positions. Let us do a 2d heatmap to see where I ran a lot. Because I noticed that the result will look to coarse, I interpolated between each two consecutive gps positions to artificially create more points which yields a finer resolution. I also threw away all runs outside of the frame we consider.

The figure looks as follows:

We can make some observations here. I have mostly been running in the western part of the city, there were some routes I ran a lot. I can see three sports grounds with a 400m track where I have been running a lot. The result almost motivates me to go back and explore the eastern part of the city. I also like the black and white version. This is the image we save and that you saw on the top of this post.

So feel free to try it yourself and let me know how the result looks for you!

The code

Leave a Reply