Click here to Skip to main content
15,890,123 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.
Posted
Updated 3-Jun-22 1:21am

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()
          gpxDoc.Load(gpxFile)

          Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(gpxDoc.NameTable)
          nsmgr.AddNamespace("x", "http://www.topografix.com/GPX/1/1")
          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)

          Next<
 
Share this answer
 
Comments
Richard MacCutchan 3-Jun-22 7:25am    
You need to study the format of the file GPX 1.0 Developer's Manual[^].
Your first stop is Google. vb.net read gpx file - Google Search[^]
 
Share this answer
 

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