tarvr Posted February 11, 2021 Share Posted February 11, 2021 (edited) I would like to read the data from a GPX file. I managed to read the Track Name, Track Description and GPX Creation Time. But I would like to read the first GPX Point latitude (trkpt lat) and the first longitude (lon) Can someone help me with this? Thanks Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("Test01.GPX") $oShortcutInit = $oXML.SelectSingleNode("//gpx/trk/name") $GPXTrackName = $oShortcutInit.text MsgBox (0, "GPXTrackName", $GPXTrackName) $oShortcutInit = $oXML.SelectSingleNode("//gpx/trk/desc") $GPXTrackDesc = $oShortcutInit.text MsgBox (0, "$GPXTrackDesc", $GPXTrackDesc) $oShortcutInit = $oXML.SelectSingleNode("//gpx/metadata/time") $GPXTrackTimeCreation = $oShortcutInit.text MsgBox (0, "$GPXTrackTimeCreation", $GPXTrackTimeCreation) $oShortcutInit = $oXML.SelectSingleNode("//gpx/trk") $GPXTrackLatitude = $oShortcutInit.text MsgBox (0, "$GPXTrackLatitude", $GPXTrackLatitude) Test01.gpx Edited February 11, 2021 by tarvr Link to comment Share on other sites More sharing options...
rudi Posted February 11, 2021 Share Posted February 11, 2021 Hi, do you have an example GPX file? I saw an attached file link just before. Clicking that one brought up an error, now it seems gone? CU, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
AspirinJunkie Posted February 11, 2021 Share Posted February 11, 2021 (edited) Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("Test01.GPX") $sLat = $oXML.SelectSingleNode("//trkpt[0]/@lat").text $sLon = $oXML.SelectSingleNode("//trkpt[0]/@lon").text MsgBox (0, "Lat / Lon", $sLat & " / " & $sLon) or Local $oXML = ObjCreate("Microsoft.XMLDOM") $oXML.load("Test01.GPX") $oFirstTrkpt = $oXML.SelectSingleNode("//trkpt[0]") $sLat = $oFirstTrkpt.getAttribute("lat") $sLon = $oFirstTrkpt.getAttribute("lon") MsgBox (0, "Lat / Lon", $sLat & " / " & $sLon) Edited February 11, 2021 by AspirinJunkie Link to comment Share on other sites More sharing options...
tarvr Posted February 11, 2021 Author Share Posted February 11, 2021 It's working Thanks for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now