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.
Solved! Go to Solution.
** 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.
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
Bruno, could you please reattach the VI as LV 8.5? I am unable to open your VI.
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?
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):
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?