国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Java > 正文

java實現百度坐標的摩卡托坐標與火星坐標轉換的示例

2019-11-26 15:35:56
字體:
來源:轉載
供稿:網友

這是百度地圖的摩卡托坐標與火星坐標的相互轉換方法,大家參考使用吧

復制代碼 代碼如下:

/**
 * 百度摩卡拖坐標與火星坐標的加密解密算法
 * @author XFan
 *
 */
public class Outer {
 private static double lat = 31.22997;
 private static double lon = 121.640756;
 public static double x_pi = lat * lon / 180.0;
 public static void main(String[] args) {
  System.out.println("摩卡坐標經緯度:"+lat+","+lon);
  System.out.println("火星坐標經緯度:"+bd_decrypt(lat,lon));
 }
 //解密成為火星坐標
 public static String bd_decrypt(double bd_lat, double bd_lon)
 {
     double x = bd_lon - 0.0065, y = bd_lat - 0.006;
     double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
     double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
     double gg_lon = z * Math.cos(theta);
     double gg_lat = z * Math.sin(theta);
     return gg_lat+","+gg_lon;
 }
 //加密成為摩卡托坐標
 public static String bd_encrypt(double gg_lat, double gg_lon)
 {
     double x = gg_lon, y = gg_lat;
     double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi);
     double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi);
     double bd_lon = z * Math.cos(theta) + 0.0065;
     double bd_lat = z * Math.sin(theta) + 0.006;
     return gg_lat+","+gg_lon;
 }
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 旬邑县| 蒙山县| 巴中市| 汤阴县| 西平县| 亚东县| 西畴县| 新民市| 旬邑县| 邛崃市| 女性| 建昌县| 扬中市| 金门县| 彝良县| 两当县| 内丘县| 靖州| 措勤县| 洛浦县| 灌阳县| 滁州市| 银川市| 开远市| 石棉县| 通榆县| 济南市| 汉源县| 梧州市| 永安市| 微山县| 郎溪县| 平度市| 肃宁县| 兰考县| 尚义县| 多伦县| 竹溪县| 汨罗市| 霍山县| 朝阳县|