LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read XML file (extn is .gpx) created by Garmin GPS

Solved!
Go to solution

I need to read an XML file with extension .gpx created by Garmin GPS. Typically, the .gpx files we work with are 20K-30K rows. My present workaround is to open the .gpx file in Excel and save it as .csv, which I then read using LabVIEW. However, we'd like to take Excel out of the workflow and directly read the .gpx file in LabVIEW.

 

The attached .zip contains the original .gpx file created by the GPS and the .xlsx file created by open-save in Excel 2007.

 

I use LabVIEW 8.5.1 on Vista 64-bit.

 

Thanks!

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 11
(12,310 Views)

** Update **

 

I was able to read the .gpx file using EasyXML tool from JKI, http://jki.net/easyxml. See attached.

However, what I get is a single block of text which looks similar to reading the .gpx in Notepad. What I want to achieve is a column format exactly as shown in the .xlsx file I attached in the original post.

 

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 2 of 11
(12,295 Views)
Solution
Accepted by Gurdas

Hi,

If this file has this format always you dont need to use an xml parser to extract the information. The function ScanFromString can do that. See the code that I developed

0 Kudos
Message 3 of 11
(12,287 Views)

Bruno, could you please reattach the VI as LV 8.5? I am unable to open your VI.

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 4 of 11
(12,280 Views)

Hi Gurdas,

you should connect a well formed cluster as data type to get the data in different arrays.

 

See this link for more information.

 

Mike

 

0 Kudos
Message 5 of 11
(12,255 Views)

Hi,

 

The code converted to 8.5.

0 Kudos
Message 6 of 11
(12,246 Views)

Hi Gurdas,


Here's a working solution that uses EasyXML (Read GPX file - LV2009.viRead GPX file - LV80.vi😞

 

1-27-2011 5-20-15 PM.png1-27-2011 5-20-20 PM.png 

Download All
Message 7 of 11
(12,224 Views)

Bruno, Jim, and Mike: Thank you!

I will play around with the solutions this weekend and reply.

 

This is outside of the scope of my original question, but I also need to convert the date in the GPX file to a number that represents the number of seconds for that day since midnight. What we do currently is open the .gpx file in Excel and then change the data column to *number with 10 digits of precision*. The decimal part of the number when multiplied with 24x3600 gives me the seconds elapsed since midnight.

 

My Q: How do I convert the date as represented in the gpx file to number with 10 digits of precision?

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 8 of 11
(12,185 Views)

EasyXML converts the date-time value to a timestamp directly.  So, you just need to convert the timestamps to seconds since midnight.  That conversion would look like this (I think):

 

Timestamp to Seconds since Midnight.png

0 Kudos
Message 9 of 11
(12,173 Views)

Bruno, I verified your solution and it works. Thank you!

Since I wanted compatibility with existing code, I converted the time data from GPS into a fraction representing number of seconds since midnight. Thus, 0.000001 represents 12:00:01 AM and 0.999999 represents 11:59:59 PM.

 

Please see attached.

 

Is there a better way to do this than what I have done?

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 10 of 11
(12,156 Views)