Get data out of Garmin XML (TCX)

Hello,
i’d like to collect data of all my garmin activities.

For example i have this activity https://docs.google.com/document/d/1536sCOAjrXbYaU0qm_fL7SNQknQT13dYcWo0dWwbDpM/edit?usp=sharing
and want to collect following data
When does the activity starts
How long does it take
How many calories i’ve burned during activity
what is the min/max/average pace/heart rate

I tried to rename the file to XML and used the XML reader, but wasn’t able to figure out, how to get the details.

Does anybody know to do this?

1 Like

Hello @Ahrron,

I’m assuming your problem is with reading the XML files, so my answer focuses on that. If there’s anything else you need help with, feel free to ask.

Reading an XML file requires the XML Reader node (you got that right), but it doesn’t parse any of the data. To get useful information out of it, you need to use the XPath node after the XML Reader, usually multiple thymes. Finally there’s some aggregations to get the min/mean/max values.

The XPath node uses standard XPath syntax, you can find more about it here:
XPath Syntax (w3schools.com)
Simply clicking the bit you’re interested in will be sufficient most of the thyme, but you can edit the Xpath queries manually. I rarely need that though.

Additional info:

  • minimum speed is mostly 0, maybe a quantile makes more sense?
  • trackpoints are not equidistant from each other, so getting the correct mean would require weighting by the duration of each trackpoint

Guten Rutsch, T
XML-Reader.knwf (210.2 KB)


3 Likes

@Thyme, frohes und gesundes Neues and thank you for your soltion.

With this base i can figure out how to get all results out of my data. Unfortunately knime 4.4.1 produces an error message when i try to configure xpath with my data source.

But in knime 4.4.2 i can configure the node and can see your settings.

@Ahrron Yeah, the error might come from small code changes between minor version differences. Guess that’s my reminder to finally update to 4.5 :slight_smile:

Anyway, happy to help. Could you please mark my post as solution? It helps people in the future discern usefullness of threads. Thank you =)

Frohes Neues to you too!
T

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.