It has been a while between posts…I was busy running.
When I started this project I anticipated that there would be changes I would have to adjust to along the way. For example, I knew the tool I was using to extract my running data from Nike+ was being retired and that I was either going to have to write my own extraction tool or find a new one.
At this point of the project, I wasn’t ready to work with the Nike+ API, so I went and found another app that allowed me to simply login and pull my data from what I have uploaded from my GPS watch. I decided to use Tapiriik, which allowed me to sync my Smashrun account to Dropbox. The nice thing about using Tapiriik is that the run data is written to my Dropbox account automatically, so that the data is almost immediately accessible. In reality, relying on 4 different apps to get my data isn’t a good idea. Ideally I should pull my data from my Nike+ account directly, but for now this alternative works.
However, there was a change in the output run data using the process described above. The data delivered by Tapiriik from Smashrun to my Dropbox account was in the form of a TCX file. TCX files in the GIS world aren’t that common, meaning there aren’t many out-of-the-box tools in typical GIS software to handle them. The TCX is an XML based format developed by Garmin to store the typical data found in a GPX file, with additional information about the activity type. If you dig around the internet, you can find the TCX schema here.
Let’s Write Some Code
To get the TCX data into a usable format, I had to rewrite some of my parsing code (available on my GitHub account!), and search for additional python snippets to handle the TCX format. The TCXtoShape.py script is now up on my GithHub and handles this elusive format.
The script uses code I found on GitHub from JHofman. His fitnesshacks project has some good TCX parsing that I incorporated to build my input lists of points from the TCX file.
The TCXtoShape.py script works in a very similar fashion as the UpdateGPXdata.py script from the first phase of my project:
- Parse the input TCX data
- Create an input list for each run
- Create the various distance/speed/time measures needed for future analysis
- Build a line shapefile for each run with the attributes
I should figure out how to embed some code in this post…
Using the TCXtoShape.py script, I reran all my runs from 2016 into a new set of shapefiles (206 so far). The output for the shapefile schemas between the different scripts, TCXtoShape and UpdateGPXdata.py, output he same formats, which will be good for when I build analysis tools. Using QGIS I have done a few quick visualizations to make sure the data looks good, but nothing fancy yet.
I calculate meters per second in the code, which can be visualized pretty easily in QGIS.
Next up, I need to start developing the analysis to understand what all this is saying. But for now, I’ll just appreciate the data.