Search code examples
c++gps

GPS Coordinates in 4 bytes


I am trying to find a method to store the standard Latitude and Longitude (double---both of 8 bytes) in 4 bytes, and viceversa (i.e. convert these data in the standard 8 byte latitude/longitude). Honestly, it is not clear how to do that. I am programming in C++, so if there is an existing function or library to do that, it would be good.


Solution

  • Fixed point rational representation is a potential solution for this purpose.

    There is no fundamental type for fixed point rational numbers, nor does the standard library provide types implementing them. The idea is fairly simple however: Scale the value of an underying integer such that the range of the underlying integer is mapped to the desired range of values.