I can import a garmin gpx file into your program. It shows distance, speed, altitude and everything. Looks really great.
However, the gpx file also contains heart rate data. They do not get displayed in the program. The program shows a value of 0 for all data points in the heart rate column.
See below a snippet from the gpx file. Note that I have obfuscated the coordinates. As you can see, the heartrate data are in an extension tag with path extensions/gpxtpx:TrackPointExtension/gpxtpx:hr
Is importing this heartrate extension already supported or is it foreseen for the future?
Note that the gpx data are generated by a Garmin Oregon 450 model.
Thanks and kind regards,
<trkpt lat="52" lon="5"><ele>18.40</ele><time>2012-02-14T21:31:10Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>77</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></trkpt><trkpt lat="52" lon="5"><ele>18.40</ele><time>2012-02-14T21:31:41Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>103</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></trkpt><trkpt lat="52.1" lon="5.1"><ele>21.29</ele><time>2012-02-14T21:31:45Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>97</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></trkpt><trkpt lat="52.2" lon="5.2"><ele>24.65</ele><time>2012-02-14T21:31:50Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>94</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></trkpt>
this request is very similar to this one (here for importing speed data from GPX files):
To sum it up: No, currently the heartrate data is not imported. But the GPX parser can be easily extended.
Are you interested in contributing?
AFAIK there are many dialects for the GPX extensions - so we need to analyze first what the most common extensions are.
I'm interested in contributing.
I don' t know how familiar you are with openoffice/libreoffice, but they offer the feature to add XSLT based input filters that can be used to transform any XML format into their internal format. I have found for example a GPX input filter on the openoffice discussion forum, which I have meanwhile enhanced a little bit and posted back to the same forum topic:
Would it make sense to add such a feature to sportstracker? It makes it possible to manage a library of filters (e.g. on sourceforge or on the download site), without having to make a new release of sportstracker for each extra dialect that needs to be supported.
I'm willing to help build such a filter support into sportstracker, based on xalan (an xslt library for Java)
I don't think so. There is already a very open Java interface for adding new ExerciseParser implementation, it wouldn't make sense to add another possibility. It would just become too complicated.
The proper way in your case would be to just extend the existing GPX parser implementation with the new features. Are you willing to contribute this too?
No problem. It was just an idea. I'll extend the existing GPX parser. I'll look at it coming weekend, though I can' t promise that I'll complete it already in this weekend. I probably need some time to get up to speed on the project organization, code and build environment.
Anyway, I'll add the heartrate from the garmin Oregon and I'll also look into the other thread you mentioned (https://sourceforge.net/projects/sportstracker/forums/forum/451565/topic/4745056), to support that one as well.
And I noticed another request (for heartrate) in feature request 3432983.
Are there any other requests for gpx that I may have overlooked?
Please keep in mind that you also need to write unit tests for all your extensions and provide appropriate test files too. There are lots of examples which show how it works…
I don't know any other gpx requests as those you already found.
Have fun, Stefan
I have updated the gpx parser and test cases. Can I commit them to the repository or do you prefer to first review the changed files (I can for example email them to you).
I have made following changes:
Support heartrate data in Garmin (Oregon) format. Test data for unit-test are from a track file from my garmin oregon device.
Support heartrate data in Holux FunTrek format. Test data for unit-test have been created artificially, based on the example in feature request 3432983. Basically, I took my garmin file and patched it according to the example in the feature request. I have added a comment to the feature request, asking the submitter to provide me with a real test file but I don't know when he will see the comment.
Added calculation of distance and speed data, based on location and time-stamp data (for gpx files that contain both location and time-stamp data). I intentionally donot parse the speed tag from the gpx file, not even when present. Reason is that speed tag does not seem to be standardized (its not in the gpx 1.1 scheme). Furthermore, the example in discussion thread https://sourceforge.net/projects/sportstracker/forums/forum/451565/topic/4745056 has speed in miles per hour and not in km/h but the speed unit is not indicated anywhere in the snippet. Maybe the speed unit is in the metadata but those where not posted in the forum. Either way, deriving speed and distance from location data + timestamps is reliable, accurate and can be done based on standardized data formats (location and time-stamp formats are both standardized)
Here is the output of hg status, after my updates:
sounds very good. Could you please submit a patch? Please link in the Patch to this forum or to the feature request.
A real test file for the Holux FunTrek would be even better, perhaps it can be provided.
I have uploaded the patch to the patch section.
I have uploaded a patch file with the real Holux test data. This new patch file must be applied on top of the previous patch file.
Great! Hopefully I will be able to test and integrate it this weekend.
I've committed your patch today, let's continue the discussion in the patch request.