fulup-bzh / GeoGate

GeoGate is an opensource tracking GPS/AIS framework to implement GTS applications.
Apache License 2.0
75 stars 39 forks source link

fix nmea longitude - pad degrees to 3 digits #35

Closed jaffadog closed 6 years ago

jaffadog commented 6 years ago

fix readme examples fix failing unit tests

i've observed some apps misinterpreting non-padded 2 digit longitude values in the encoded $GPRMC sentences - like: $GPRMC,165550.00,A,3732.74173,N,7620.78632,W,3.6,1.46,181027,,,A*4D

...and reading that as 762 degrees W... which is nuts.. but meh.

The NMEA standard says:

"Longitude yyyyy.yy Fixed/Variable length field: degreesminutes.decimal - 3 fixed digits of degrees, 2 fixed digits of minutes and a variable number of digits for decimal-fraction of minutes. Leading zeros always included for degrees and minutes to maintain fixed length. The decimal point and associated decimal-fraction are optional if full resolution is not required."

So I have adjusted the code to pad longitude degrees to 3 digits, and latitude degrees to 2 digits.

fulup-bzh commented 6 years ago

Thank you for this contribution