An App for Mapping My Outdoor Activities With Apple Watch Using GPX Tracks

I use an Apple Watch to track my activities, whether that be workouts or recreational. For outdoor activities, the watch records location data throughout the activity. This is later shown on a map in the Fitness app on the iPhone. While that map is interactive, exporting it only exports a low resolution image, and not the actual route.

A walking track is overlaid on a map.

When I share an activity on a blog post I like to show the map but I don’t like the idea of just sharing an image of the map. I would like to get the actual data out so that it can be overlaid on an interactive map using various mapping tools.

I found an app on the App Store that can export the data, among many other features, but I wasn’t keen on paying a subscription for this one small occasional use case. As an app developer, I know that access to this data is controlled by the Health related privacy settings on the iPhone and is accessible using the HealthKit framework. So I decided make a small app to get this data out while also gaining familiarity with that part of the iOS SDK. A few weeks ago I got started on it. I worked on it in small chunks of time, as I usually do with such side projects. The UI came together pretty quickly as a SwiftUI app. It is nothing special but looks presentable and gets the job done.

Screenshot of an app showing a list of workouts with options to fetch and share the route from some of them.

It took just a little bit longer to get the data out from HealthKit. Converting it to GPX files was straightforward. Once I had created a file I could use the share sheet to get it into other apps or to simply save it. From there it can be imported into tools that put it on a map.

For example, here’s a GPX file of a walk at Mount Tabor Park. It can be utilized to create an embedded map as shown below.

See full screen

Or even into Google Maps. In fact once imported there, you can view the track with elevation by selecting the option for Google Earth and enabling the 3D view. I love this option as it adds another dimension (literally 😂) to the activity.

Screenshot of track on 3D view from Google Earth.

Both these presentation styles are far more interesting to me than just a low resolution image out of the Fitness app.

Conversation