Export Runmeter workouts to geojson
I’ve been actively running for about 4 years now and through the years I happened to use Runmeter app for iPhone to track my runs. Especially in the beginning this app was priceless to me because it often gave me motivation to go out for a run and beat that previous time record even on the days when running was the last thing I wanted to do. To this day I’ve accumulated about 500 runs and while all these runs are viewable in the app I really wanted to find a way to export them to a format, like geojson, that can be easily manipulated and visualized.
It’s all in the database
Like most iOS apps, Runmeter stores its data in sqlite database. It turned out that getting database out of the app is easy - you can do it through File Sharing in iTunes:
Once database is exported to selected location, we can use sqlite3
command to see its contents:
Two tables are interesting here:
run
- contains information about individual runs, like date, start time, distance, etc.coordinate
- stores coordinates for each run every time they are logged by device.
Now we can write simple node.js
script that reads data from database with sqlite3
package and builds geojson structure with LineString geometries. Each run looks like this:
Optimize for the web
The resulting geojson file turns out to be about 10mb, which can take a while to download even for users sitting on a wifi connection, not to mention those on 3G. In my previous blog post I wrote about small utility geojson-minifier
which can shrink the size of geojson files 3-4 times. Running our runs.geojson
through this utility indeed does make it much smaller.
With gzip compression file shrinks even further. While still being quite big, considering that it contains about 250000 coordinates, it’s acceptable.
After decoding packed geojson with geojson-minifier unpack
method here’s what runs look like on beautiful Mapbox Outdoors map:
What about your runs?
Do you track your runs or bike rides with Runmeter or other apps like Runkeeper, Endomondo or Strava? It would be interesting to see if this script can be customized to support more providers!