Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am looking for code in VB.Net (or C#) that can read a GPX File and output Lat, LOn, Time and Elev to a csv file

What I have tried:

Using my limited knowledge of XML I haven't got very far.
Updated 3-Jun-22 1:21am

Your first stop is Google. read gpx file - Google Search[^]
Share this answer
I tried this as shown below but it only returns the elevation and time. I'm not sure how to get the Lat and Lon values:

Dim gpxFile As String = "C:\Users\xxxxxxx\Downloads\ILU 2022038.gpx"
          Dim gpxDoc As XmlDocument = New XmlDocument()

          Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(gpxDoc.NameTable)
          nsmgr.AddNamespace("x", "")
          Dim nl As XmlNodeList = gpxDoc.SelectNodes("//x:trkpt", nsmgr)

          For Each xnode As XmlNode In nl
              Dim name As String = xnode.Name
              Debug.Print(xnode.Name & vbCrLf & xnode.InnerText)

Share this answer
Richard MacCutchan 3-Jun-22 7:25am    
You need to study the format of the file GPX 1.0 Developer's Manual[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900