Reading GPX

For my project Pihlometer, which is a Rally and tour computer for a motorbike I want to calculate distances to Bonus Points. The koord are available in a GPX File (which is a kind of XML). It is NOT possible to change the format!! I have tried Google and a lot of other search's, but I only found GPX Write (for Datalogger). I have not found a Function that can read GPX Coords from a file. The calculation is done by using TinyGps++ and is not a problem, connection to SD also no problem.

I looking for something like this (Syntax maybe not 100% ok) ;)

Boolean GetGPXKoords(&file, NrOfSentence, &NameOfPoint, &comment &LAT, &LON) { // Pointer of (open) File // Nr. of point I want to read (I count them by my self and call the function on my own for next point) // Name of the Point "TowerOfLondon" // Comment of this point (if available) // LAT 51.508530, LON -0.076132 if (point) return true else false }

Could someone help?

Where is the GPX file stored ?

...R

The koord are available in a GPX File (which is a kind of XML).

Only YOU have access to this file. If you want help parsing the file, you must show some sample data from the file.

I did not get the impression the OP is asking for help parsing the data, but rather in finding and retrieving the data from the file.

…R

Robin2: I did not get the impression the OP is asking for help parsing the data, but rather in finding and retrieving the data from the file.

...R

I'm not sure that I see a distinction. Finding useful parts and converting them to numeric form is what parsing is all about.

PaulS: I'm not sure that I see a distinction. Finding useful parts and converting them to numeric form is what parsing is all about.

I really posted Reply #3 to stimulate the OP to clarify the position.

My impression is that he cannot find the location of the data within the file - but I have no idea where the file is. I was thinking of him extracting (say) 100 bytes at position NNNN and then parsing the 100 bytes. However I can see how you include finding the data in the concept of parsing.

...R

Thanks first for answer. Have not answer fast because get no info on new posts and on traveling....

The data itself are stored on a SD, or an Fram. The output is generatet by Garmin Basecamp (mark points, export, format gpx). I try ti deliver test data on weekend...

The main question is: Is there a parser for Gpx availible? The datas are availible on SD,in Fram (flat or in a DB or an array). But I prefere Fram because the SD is not 100% availible (but this is an other theme)

Is there a parser for Gpx availible?

Not that I'm aware of, but it is probably not too difficult to write one. Assuming, of course, that the file is a text file rather than a binary file.

The koord are available in a GPX File (which is a kind of XML).

This suggests that the file is a text file.

Can't you open one and look at the data?

But I prefere Fram

Are you able to read from any kind of Fram? I thought that was a company that made oil filters.

Yes its a text file. and FRam is Ferro Magnetic Ram -
I also add a Original GPX File - exact this I want to read. Intresting is more or less only the Name and the Koords.

That What I need I have marked in the following example in Bold…
The result could best be a structure (I define them Global - I have an Array in the FRam - and Place 0 could used for the transfer.

<wpt lat=“51.507646003738046” lon="-0.701687000691891">
-0.11
2015-09-24T21:04:58Z
<name>01 - High Street Bray
<cmt>High Street Bray
<desc>High Street Bray

GP-TEST.txt (54.1 KB)

GP-TEST.txt (54.1 KB)

How does an FRAM interface with an Arduino?

To keep things simple, assuming you have the file on an SD Card, have you successfully written an Arduino program to read a chunk of text from the file (without any attempt at parsing) and display it on the Serial Monitor.

If not, that should be your starting point.

…R

FRAM is accessed via SPI pins, same as SD card.
Many 3.3V and 5V parts available.
SRAM read/write access speed, with EEPROM non-volatility. And waaaay more write cycles than EEPROM supports, from 1 Trillion to 100 trillion.
http://www.cypress.com/?docID=47756

It is not difficult to parse strings like this:

Use the standard functions strcmp(), strtok() to find keywords and characters.

Keep in mind that float or double on the Arduino have only 6-7 digits of precision and cannot be used to accurately store latitude and longitude values. Use long integers for those, in units of degrees100000 or degrees1000000.

That's rigt. Per SPI. Cmp = compare, tok = token... Ok, that helps. My problem that I does not nowwhich C keywords realy availible (be a basic junki) But now I have a starting point! Thanks...

BTW: is there a list which C standard is support?

Just assume that all the regular C/C++ functions are supported.

Have a look at the parse example in Serial Input Basics

...R