Decoding Specialized FIT files (30 Day Map Challenge Day 2, Lines)
I have a new eBike! I'll write about it more before long, but for now, what's relevant to the 30 Day Map Challenge is that it's from Specialized, and if you use the Specialized phone app, it can record all sorts of fun statistics for rides, including GPS coordinates.
Aside: many discussions on the web talk about the Specialized Mission Control app. I think, but I'm not sure, that's an older app for older bikes that use a different protocol. The current app on the Play Store just calls itself Specialized and doesn't say Mission Control anywhere, and likewise for the various pages I've found on Specialized's website. There isn't a lot of web discussion on the newer Specialized app, even though I gather it's been out for a couple of years now.
Unfortunately, getting that data out of the Specialized app is a bit of a pain. Whenever you finish a ride track, it uploads to Specialized, but there doesn't seem to be able to get to it on Specialized's website. On the phone, in the app's file space, it's stored in some weird diffuse format that I haven't been able to decode, and it doesn't seem like anyone else has either. You can tap on the three-dots menu and Export FIT file, but that doesn't save to the device either. Your only options are to copy it to your Google file space or email it.
Once you've managed to get it onto the computer ... what can you do with a .fit file? Not much, it turns out. You can use gpsbabel to extract the GPS coordinates and save them to a GPX file:
gpsbabel -i garmin_fit -f ride-22732578.fit -o gpx -F ride-22732578.gpxbut that loses all the other interesting statistics.
Enter fitdecode. It's a Python module that can read .fit files. It comes with utilities to convert to JSON or TXT, which are useful for understanding what sort of data Specialized is saving, but it's not very useful for viewing maps or plotting the various other parameters. (The Specialized app will show a nice plot of the parameters, but if I want to analyze my ride, I'd sure rather do it on my big home monitor than on a 5" phone screen!)
With fitdecode it was pretty simple to whip up a script that reads the .fit file, outputs a GPX file (I made that dependent on some of the code I've already written for PyTopo), and also saves relevant data to a CSV file. I'll eventually add plotting of the CSV values, but I haven't gotten that far yet. It spews a ton of warnings -- FIT is apparently a Garmin format and apparently Specialized's version doesn't make fitdecode very happy — but it works.
What I have so far is at
fitread.py.
[ 13:54 Nov 02, 2024 More mapping | permalink to this entry | ]