How to convert my binary (hex) data to latitude and longitude?

前端 未结 3 801
伪装坚强ぢ
伪装坚强ぢ 2021-01-06 01:41

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.2         


        
3条回答
  •  -上瘾入骨i
    2021-01-06 02:44

    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

    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

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

    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();
    }
    

提交回复
热议问题