Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading zeros in RMC (Longitude, Lattitude) missing #11

Closed
AK-Homberger opened this issue Jul 31, 2019 · 2 comments
Closed

Leading zeros in RMC (Longitude, Lattitude) missing #11

AK-Homberger opened this issue Jul 31, 2019 · 2 comments

Comments

@AK-Homberger
Copy link

Hi Timo,

While using this Library ,I identified a compatibility problem with a loogbook app.
It looks like the Longitude, Latttude information is not formatted according to the NMEA specification, which requires leading zeros. Most apps will ignore the missing leading zeros, but not all.

Changing the formatting in NMEA0183Msg.h worked for me (%08.3f and %09.3f).

Regards,
Andreas

// Add Latitude field. Also E/W will be added. Latitude is in degrees. Negative value is W. E.g.
// AddLatitudeField(-5.2345); -> ,5.235,W
bool AddLatitudeField(double Latitude, const char *Format="%08.3f");

// Add Longitude field. Also N/S will be added. Longitude is in degrees. Negative value is S. E.g.
// AddLongitudeField(-5.2345); -> ,514.070,S
bool AddLongitudeField(double Longitude, const char *Format="%09.3f");
@ttlappalainen
Copy link
Owner

Sorry for delay. I have nod had time to check this.

Do you know how many decimals are allowed on the lat/lon? With current GPS accuracy we should have at least 4 and up to 6. But are some apps limited to 3? I think I set it to 3, since some app could not read more. So there should be possibility to set format.

@AK-Homberger
Copy link
Author

Hi Timo,

My problem was just the missing leading zeros. The formatting with "%08.3f" for Latitude and "%09.3f" for Longitude is fixing the leading zeros problem. Not sure about the maximum decimals. According to the NMEA standard the decimal fraction is optinal. Version 301 defines maximum 2 decimals. Not sure if this has changed in later versions. But all apps I tsted so far, are working with three decimals.

Regards,
Andreas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants