Extensions in GPX-file

Topics: Help
Jan 12, 2012 at 10:17 AM

Hi everybody,

I use GPX-files with heart rate included as an extension. Importing the files and showing on the map works fine.

But I've no idea to extract the heartrate.

Here is a sample of my GPX-file:

<?xml version="1.0" encoding="utf-8"?>
<gpx xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd" version="1.1" creator="Sports Tracker" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
    <name>Walking 9/12/2011/15:34:22.58</name>
    <link href="www.sports-tracker.com">
      <text>Sports Tracker</text>
      <trkpt lat="49.76015" lon="9.836456666666667">
      <trkpt lat="49.76015" lon="9.836456666666667">

How can I readout he gpxtpx:hr value ?

Hope anybody can help me.


Best regards,


Jan 12, 2012 at 11:06 AM

after deserialization, check gpx.extensions property, it contains your trackpoints xml

Jan 12, 2012 at 11:47 AM

Hi radioman,

yes, I found the extensions property, but I have no idea to grab the gpxtpx:hr value.

At the expression WPT.extensions. I stuck, because the choice after the last dot is Any, Equals, GetHashCode, GetType, ReferenceEquals and ToString. 

What is the right choice and how to do it then ?

Could you please give me a line of code, I'm using VB2010, but C# snippet will also help.

I'm sorry, but I'm not so good in coding.

Best regards,



Jan 12, 2012 at 11:52 AM

the type is XmlElement, so you have to use its functions to find required element and get it's content...