An app I loved has gone, but I'm using it as inspiration for a personal project.
First, an update on Flutter
I've continued working with Flutter and Dart in my spare time. I've really enjoyed it, and I still hope to get the RoundsLogging app rebuilt in Flutter at some point. State management is one aspect of Flutter that isn't quite as straightforward as Vue. Unlike Vue, where Vuex is the standard for state management, Flutter has several options, none of which seem quite as easy to work with as Vuex. I've been working with Provider. I also plan on having a look at BLoC. Once I've worked that out, I can move forward with the app.
Endomondo
I used Endomondo for about ten years. It was my favorite running app, and, in my opinion, had far better features than any other app available. Even apps available now, in 2021, lack many of the features available on Endomondo back in 2012. I'm a data junkie, and I loved the variety of stats offered in Endomondo. Since I can't find these features in any existing apps, I plan on writing the code to extract and calculate the stats myself.
GPX Files
Most running apps store data in GPX files, which are essentially XML files that store tracking data. In addition to basic info such as time and date, the bulk of the file consists of a series of trackpoints made up of coordinates, elevation, and a timestamp. The data is collected every 2-3 seconds for the duration of the run.
<trkpt lat="36.844810485839844" lon="-75.98933410644531">
<ele>5.199999809265137</ele>
<time>2010-10-30T12:02:07.000Z</time>
</trkpt>
<trkpt lat="36.84482955932617" lon="-75.9892578125">
<ele>5.199999809265137</ele>
<time>2010-10-30T12:02:10.000Z</time>
</trkpt>
<trkpt lat="36.844844818115234" lon="-75.98918151855469">
<ele>5.199999809265137</ele>
<time>2010-10-30T12:02:13.000Z</time>
</trkpt>
Calculating Distance
Thanks to this Stack Overflow post I was able to accurately calculate distance between points.
const distance = (lat1, lon1, lat2, lon2) => {
var p = 0.017453292519943295 // Math.PI / 180
var c = Math.cos
var a =
0.5 -
c((lat2 - lat1) * p) / 2 +
(c(lat1 * p) * c(lat2 * p) * (1 - c((lon2 - lon1) * p))) / 2
return 12742 * Math.asin(Math.sqrt(a)) // 2 * R; R = 6371 km
}
Now I'm able to submit a GPX file and calculate the total distance and time. It's pretty simple so far, but it works.
Up Next
Next, I want to allow calculation of other stats that used to be covered by Endomondo, such as best 1 km, 1 mi, 5 km, etc. Eventually I'd like to include a way to show these segments on a map.