本文介绍了如何把二进制(十六进制)数据转换为纬度和经度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有经过地理坐标位置的一些二进制数据流 - 经度和纬度。我需要找到它们连接codeD的方法。

I have some binary data stream which passes geo location coordinates - latitude and longitude. I need to find the method they are encoded.

4adac812 = 74°26.2851' = 74.438085
2b6059f9 = 43°0.2763'  = 43.004605

4adaee12 = 74°26.3003' = 74.438338
2a3c8df9 = 42°56.3177' = 42.938628

4ae86d11 = 74°40.1463' = 74.669105
2afd0efb = 42°59.6263' = 42.993772

第一个值是十六进制值。 2楼和放大器;第三是我在(其中一个是转换使用不知道)的输出得到的值。

1st value is hex value. 2nd & 3rd are values that I get in output (not sure which one is used in conversion).

我发现,第一个字节再presents整数值(0x4a = 74)的一部分。但我无法找到部分如何小数为EN codeD。

I've found that first byte represents integer part of value (0x4a = 74). But I cannot find how decimal part is encoded.

我真的AP preciate任何帮助!

I would really appreciate any help!

感谢。

-

UPD:此流来自于通过TCP协议的一些中国人的GPS服务器软件。我没有对克伦特软件源或文档。我想这是写在VC ++ 6,并使用一些标准的实现。

Upd: This stream comes from some "chinese" gps server software through tcp protocol. I have no sources or documentation for clent software. I suppose it was written in VC++6 and uses some standard implementations.

-

UPD:这里是包我得到:

Upd: Here is packets I get:

Hex data:
41 00 00 00  13 bd b2 2c
4a e8 6d 11  2a 3c 8d f9
f6 0c ee 13

Log data in client soft:
[Lng] 74°40.1463', direction:1
[Lat] 42°56.3177', direction:1
[Head] direction:1006, speed:3318, AVA:1
[Time] 2011-02-25 19:52:19

Result data in client (UI):
74.669105
42.938628
Head 100 // floor(1006/10)
Speed 61.1 // floor(3318/54.3)


41 00 00 00  b1 bc b2 2c
4a da ee 12  2b 60 59 f9
00 00 bc 11
[Lng] 74°26.3003', direction:1
[Lat] 43°0.2763', direction:1
[Head] direction:444, speed:0, AVA:1
[Time] 2011-02-25 19:50:49
74.438338
43.004605


00 00 00 00  21 bd b2 2c
4a da c8 12  aa fd 0e fb
0d 0b e1 1d
[Lng] 74°26.2851', direction:1
[Lat] 42°59.6263', direction:1
[Head] direction:3553, speed:2829, AVA:1
[Time] 2011-02-25 19:52:33
74.438085
42.993772

我不知道第4个字节的意思。

I don't know what first 4 bytes mean.

我发现第5字节重新present的低7位秒的数目。 (也许5-8位的时间?)
字节9重新纬度的present整数。

I found the lower 7 bits of 5th byte represent the number of sec. (maybe 5-8 bits are time?)Byte 9 represent integer of Lat.

字节13是液化天然气的整数。

Byte 13 is integer of Lng.

颠倒(字字节)字节17-18是速度。

Bytes 17-18 reversed (word byte) is speed.

字节逆转19-20是AVA&AMP(?);方向(4 + 12位)。 (顺便说一句,有人知道AVA是什么?)

Bytes 19-20 reversed is ava(?) & direction (4 + 12 bits). (btw, somebody knows what ava is?)

和一个音符。在第3包13字节你可以看到只有7位用于降低。我想第1位不意味不便(我删除它在开始的时候,对不起,如果我错了)。

And one note. In 3rd packet 13th byte you can see only lower 7 bits are used. I guess 1st bit doesnt mean smth (I removed it in the beginning, sorry if I'm wrong).

推荐答案

我已经重新排列数据,以便我们首先有3个longitures然后3纬度:

I have reordered your data so that we first have 3 longitures and then 3 latitudes:

74.438085,74.438338,74.669105,43.004605,42.938628,42.993772

74.438085, 74.438338, 74.669105, 43.004605, 42.938628, 42.993772

这是十六进制的最适合我能想出是:

This is the best fit of the hexadecimals i can come up with is:

74.437368,74.439881,74.668392,42.993224,42.961388,42.982391

74.437368, 74.439881, 74.668392, 42.993224, 42.961388, 42.982391

的区别是:-0.000717,0.001543,-0.000713,-0.011381,0.022760,-0.011381

The differences are: -0.000717, 0.001543, -0.000713, -0.011381, 0.022760, -0.011381

这是从完整Hex'es(4不是3个字节)产生这些值的程序是:

The program that generates these values from the complete Hex'es (4 not 3 bytes) is:

int main(int argc, char** argv) {
    int a[] = { 0x4adac812, 0x4adaee12, 0x4ae86d11, 0x2b6059f9, 0x2a3c8df9, 0x2afd0efb };
    int i = 0;
    while(i<3) {
        double b = (double)a[i] / (2<<(3*8)) * 8.668993 -250.0197;
        printf("%f\n",b);
        i++;
    }
    while(i<6) {
        double b = (double)a[i] / (2<<(3*8)) *  0.05586007 +41.78172;
        printf("%f\n",b);
    i++;
    }
    printf("press key");
    getch();
}

这篇关于如何把二进制(十六进制)数据转换为纬度和经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 16:23