zoukankan      html  css  js  c++  java
  • 经纬度转灵图编码

    帮人做了个简单的定位当前位置,然后显示出灵图编码。

    = =很蛋疼的编码,就是用经纬度算出来的而已。

    传说,似乎是因为我国法律规定不能显示经纬度还是啥的。。。

            double longitude = location.getLongitude();
            double latitude = location.getLatitude();
            if(longitude >= 100) longitude -= 100;
            longitude *= 10000;
            latitude *= 10000;
            
            String str1 = Integer.toString((int)longitude);
            String str2 = Integer.toString((int)latitude);
            
            if(str2.length() < 6) str2 = "0" + str2;
            if(str1.length() < 6) str1 = "0" + str1; 
            Log.w("str1" , str1);
            Log.w("str2" , str2);
            String code = ""+str2.charAt(4) + str2.charAt(1) + str1.charAt(3) + str2.charAt(5)
                + "-" + str2.charAt(3) + str1.charAt(4) + str1.charAt(1) + str1.charAt(2)
                    + "-" + str1.charAt(5) + str2.charAt(0) + str2.charAt(2) + str1.charAt(0);


    上面是写的android程序的一段,一眼就能看出来了。

    就是经纬度各取六位。

    灵图编码是  xxxx-xxxx-xxxx

    12位,然后经纬度各六位共12位出现的位置按灵图要求的位置就好了。

  • 相关阅读:
    mysql 锁相关的视图(未整理)
    MYSQL的用户变量(@)和系统变量(@@)
    mysql杀死线程
    mysql 系统变量和session变量
    Oracle DB 移动数据
    MySQL数据库------常用函数
    练习-----查询
    练习建表
    课堂笔记总结
    数据库--------用代码来创建表
  • 原文地址:https://www.cnblogs.com/x1957/p/3308707.html
Copyright © 2011-2022 走看看