hearth-rate in garmin gpx file ignored

Alex Wulms
2012-02-14
2013-05-01
  • Alex Wulms
    Alex Wulms
    2012-02-14

    Hi,

    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,
    Alex

    <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>

     
  • jede28
    jede28
    2012-02-16

    Hi Alex,

    this request is very similar to this one (here for importing speed data from GPX files):
    https://sourceforge.net/projects/sportstracker/forums/forum/451565/topic/4745056

    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.

    Bye, Stefan

     
  • Alex Wulms
    Alex Wulms
    2012-02-19

    Hi Stefan,

    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:
    http://user.services.openoffice.org/en/forum/viewtopic.php?f=9&t=5511

    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)

    Cheers,
    Alex

     
  • jede28
    jede28
    2012-02-20

    Hi Alex,

    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?

    Bye, Stefan

     
  • Alex Wulms
    Alex Wulms
    2012-02-21

    Hi Stefan,

    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?

    Cheers,
    Alex

    Cheers,
    Alex

     
  • jede28
    jede28
    2012-02-22

    Sounds great!

    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

     
  • Alex Wulms
    Alex Wulms
    2012-02-26

    Hi 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:

    M st-exerciseviewer/src/main/groovy/de/saring/exerciseviewer/parser/impl/TopoGrafixGpxParser.groovy
    M st-exerciseviewer/src/main/java/de/saring/exerciseviewer/data/RecordingMode.java
    M st-exerciseviewer/src/test/groovy/de/saring/exerciseviewer/parser/impl/TopoGrafixGpxParserTest.groovy
    A st-exerciseviewer/misc/testdata/gpx/bike-tour-garmin-oregon-with-heartrate.gpx
    A st-exerciseviewer/misc/testdata/gpx/bike-tour-holux-funtrek-130-pro-with-heartrate.gpx
    

    Best regards,
    Alex

     
  • jede28
    jede28
    2012-02-26

    Hi Alex,

    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.

    Bye, Stefan

     
  • Alex Wulms
    Alex Wulms
    2012-02-26

    Hi Stefan,

    I have uploaded the patch to the patch section.

    Cheers,
    Alex

     
  • Alex Wulms
    Alex Wulms
    2012-02-28

    Hi Stefan,

    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.

    Kind regards,
    Alex

     
  • jede28
    jede28
    2012-02-29

    Great! Hopefully I will be able to test and integrate it this weekend.

    Bye, Stefan

     
  • jede28
    jede28
    2012-03-03

    I've committed your patch today, let's continue the discussion in the patch request.

    Bye, Stefan