adafruit/Adafruit_GPS

Missing documentation about how to decode `latitude_fixed` and `longitude_fixed`

MichaelMauderer opened this issue · 3 comments

The library includes a high precision integer encoded value for latitude and longitude in the form of latitude_fixed and longitude_fixed. While it is possible to reverse engineer the encoding from the source code, there is no documentation or example on how to decode those values.

The forum contains this example using string manipulation (probably not ideal).
https://forums.adafruit.com/viewtopic.php?f=57&t=110423&p=551739&hilit=longitude_fixed#p551856

What exactly are you looking for here? In line comments in the code, or something else?

It's been a while since I looked at this. If I remember correctly, the ideal solution would be to have a helper function that does the conversion. Some additional inline comments might be enough, too, though.

int32_t latitude_fixed; ///< Fixed point latitude in decimal degrees.
///< Divide by 10000000.0 to get a double.
int32_t longitude_fixed; ///< Fixed point longitude in decimal degrees
///< Divide by 10000000.0 to get a double.
will appear soon in the source code. There is no encoding, just a factor of 10^7.