如何计算GPS数据
How to compute GPS data?
我需要使用以下信息计算GPS数据。
Bits size description
Bits 0-25 26 Latitude Location latitude Latitude as 26-bit integer * 100,000
Bits 26-51 26 Longitude Location longitude Longitude as 26-bit integer * 100,000
基于上述信息,我知道1)纬度值可以为 -90.xxxxxx,即需要7位才能容纳90(2 ^ 7)的值。基于信息,我如何计算纬度并转换为Mantissa(7位)和指数(19位)部分。另外,标志位怎么样?例如,值87.45需要以87存储到7位的方式存储,其中19位存储了值45。
2)类似的经度值可以为 -180,需要8位才能根据信息来适应180(2 ^8)的值) 部分。另外,标志位怎么样?
例如,值130.50需要以130存储到8位的方式存储,其中18位存储该值50。
我认为您在看这个错误的……您的身份为52位值,其中包含LAT和LON作为整数值,对吗?不用担心曼蒂萨(Mantissa)。您需要将输入的两个部分视为单独的整数,然后将每个部分除以100,000,以获得学位。
尝试类似:
#include <stdint.h>
int main() {
int64_t input = yourGpsVal();
// note: lat/lon may be the wrong way round
// strip off the rightmost 26 bits and convert to double
double lat = ( input >> 26 ) / 100000.;
// zero the bits left of the rightmost 26 and convert to double
double lon = ( input % ( 1 << 26 )) / 100000.;
}
在Wandbox上查看此演示。http://melpon.org/wandbox/permlink/xtidofmkh0wk5lic
相关文章:
- 防止主数据类型C++的隐式转换
- 用于访问容器<T>数据成员的正确 API
- 嵌套在类中时无法设置成员数据
- 使用流处理接收到的数据
- 静态数据成员的问题-修复链接错误会导致编译器错误
- 处理小于cpu数据总线的数据类型.(c++转换为机器代码)
- 在cuda线程之间共享大量常量数据
- C++将文本文件中的数据读取到结构数组中
- 如何在C++中序列化结构数据
- 在C++中打印指向不同基元数据类型的指针的内存地址
- 通过套接字[TCP]传输数据 如何在C / C ++中打包多个整数并使用send() recv()传输数据
- 在c代码之间共享数据的最佳方式
- 链表,反向函数,数据结构
- 模拟GPS数据,以便使用Qt与Traccar一起使用
- 在SD卡上读取和存储二进制GPS数据方面的问题
- 从GPS向SIGFOX传输数据
- 如何计算GPS数据
- 与GPS的串行通信-连续数据传输
- 平滑后的GPS数据比较
- GP635T gps传感器的数据输出