01-27-2011 06:55 AM - edited 01-27-2011 06:56 AM
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.
01-27-2011 07:09 AM
** 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.
01-27-2011 07:32 AM
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
01-27-2011 07:42 AM
Bruno, could you please reattach the VI as LV 8.5? I am unable to open your VI.
01-27-2011 11:32 AM
you should connect a well formed cluster as data type to get the data in different arrays.
See this link for more information.
01-27-2011 12:17 PM
01-27-2011 07:22 PM - edited 01-27-2011 07:25 PM
Here's a working solution that uses EasyXML (Read GPX file - LV2009.vi, Read GPX file - LV80.vi😞
01-28-2011 12:54 PM
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?
01-28-2011 02:45 PM
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):
01-28-2011 11:47 PM - edited 01-28-2011 11:49 PM
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?