Correct format of GPS Coordinates

Is there a way to amend the GPS output for the log file please.

Although it is in CSV, the Lat / Long do not have a decimal point and this will make more work for conversion.

For example the output is (obfuscated)…

02/02/2022,17:57:49.64,-326.66,-24.41,-922.85,-3.61,1.33,-1.24,-37.20,81.60,-106.65,31.91,02/02/2022,17:57:49.700,530165914,-5654677,225530,8,3,27,20258293,217,8.009,

When it fact I would like it to record the Lat / Long as…

53.0165914,-0.5654677

Also, has anyone seen a solution to create a .kml file on the logging card please?

Many thanks.

If you’re using Arduino, you have to use any of the NMEA data extraction libraries. TINYGPS, MicroNMEA, NMEAParser are a few to name. Without any library once I separated all the *parameters using the substring function of the Arduino. That makes the code very long.

Thank you for the reply @rpiloverbd. I presume it would mean changing the existing source code from GitHub? Do you perhaps have any examples of what you have done and willing to share please? Happy for a PM.

Lat / Long do not have a decimal point

Why not? Using code tags, post the code that creates that line of output. Possibly those are integers, in units of millionths or billionths of a degree.

GPS modules usually output NMEA sentences, which do contain a decimal point. However, the format of the number is in degrees and minutes: DDDMM.MMMMM, which most people convert to decimal degrees.

Why not? Using code tags, post the code that creates that line of output. Possibly those are integers, in units of millionths or billionths of a degree.

That’s the bit I am unsure about. I am using the standard and latest Artemis OLA firmware (https://github.com/sparkfun/OpenLog_Art … og_Artemis), however I cannot find anything in the code which formats the GPS output.

I’m using a Sparkfun SAM-M8Q GPS Receiver, could it be a preconfigured setting there. All I can say is the output in the logs just don’t appear to be in the correct format and will need additional parsing which seems to defeat the object of the logger.

The code that prints the GPS latitude and longitude to the SD card can be found here:

https://github.com/sparkfun/OpenLog_Art … ensors.ino

              if (nodeSetting->logPosition)
              {
                sprintf(tempData, "%d,%d,", nodeDevice->getLatitude(), nodeDevice->getLongitude());
                strcat(outputData, tempData);
              }

As I suspected, integers are printed.

The measurement units are described here:

https://github.com/sparkfun/OpenLog_Art … NSS-boards

This cryptic notation probably means that the integer represents decimal degrees multiplied by 10^7 or 10 million.

Lat & Lon gps_Lat,gps_Long Degrees-7

So, convert the integer to double and multiply by 1.0E-7 to get decimal degrees.

That’ really helpful @jremington ! Thank you so much for taking the time to reply and explain.

I shall now look at amending the source code to output the data in the correct decimal degrees. Multiplying the figures I have in the logs by 1.0E-7 does indeed give me the corrected readings :smiley: .

I shall post the amended code if I get it working :slight_smile:

Are you sure you need to modify the library? Some program will have to read and interpret the file produced, and it is just as easy to apply the scale factor then.

That is true, however there will be a large amount of data across a number of devices. I thought it may be easier by amending the source code as it will then save separate parsing later. Particularly as I want to add an OLED too. However, at the moment, the unmodified original source code doesn’t want to compile as posted here :frowning:

viewtopic.php?f=169&t=57168