Jump to content

Recommended Posts

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?



Local $oXML = ObjCreate("Microsoft.XMLDOM")

$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)



Edited by tarvr
Link to post
Share on other sites


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 post
Share on other sites
Local $oXML = ObjCreate("Microsoft.XMLDOM")

$sLat =  $oXML.SelectSingleNode("//trkpt[0]/@lat").text
$sLon =  $oXML.SelectSingleNode("//trkpt[0]/@lon").text

MsgBox (0, "Lat / Lon", $sLat & " / " & $sLon)


Local $oXML = ObjCreate("Microsoft.XMLDOM")

$oFirstTrkpt = $oXML.SelectSingleNode("//trkpt[0]")
$sLat = $oFirstTrkpt.getAttribute("lat")
$sLon = $oFirstTrkpt.getAttribute("lon")

MsgBox (0, "Lat / Lon", $sLat & " / " & $sLon)


Edited by AspirinJunkie
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...