小编moh*_*ani的帖子

从Google Maps网址ftid(十六进制)获取纬度/经度

当使用android Google Maps App共享按钮作为位置时,它只是向其他类似这样的应用程序返回一个URL:

https:// o gl /地图/ tkNXzF2krmR2

这是一个Google短网址,可以转换为长网址(使用goole短网址api),如下所示:

http://maps.google.com/?q=Tehran+Province,+Tehran,+Banafsheh+3&ftid=0x3f8dfd04d309f925:0x2867166b05b0bfe6&hl=zh-CN&gl=us&shorturl=1

显然,此url没有纯的纬度和经度值。但似乎值在url中的ftid参数后面。用“:”字符分隔。

请帮助我从这种十六进制格式提取纬度和经度值

我正在使用PHP语言,但其他人也可以提供帮助。我需要这样的功能:(这不起作用):

    函数hextolatlon($ hex){
            //假设十六进制为0x1446041F或0x447D1100之类的值
            //转换为有符号整数
            $ h = $ hex&0xFF;
            $ h =($ h> 8)&0xFF);
            $ h =($ h> 16)&0xFF);
            $ h =($ h> 24)&0xFF);
            $ negative =($ h >> 31)!= 0; //获得标志
            if($ negative){
                $ h =〜$ h;
                $ h = $ h&0x7FFFFFFF;
                $ h ++;
            }
            //转换为度和分钟
            $ degrees = floor($ h / 10000000);
            $ minutes = $ h%10000000;
            //转换为全学位
            $ degrees + =($ minutes …

php android hex location google-maps

1
推荐指数
1
解决办法
771
查看次数

标签 统计

android ×1

google-maps ×1

hex ×1

location ×1

php ×1