经纬度与web墨卡托相互转换
程序员文章站
2022-04-04 12:14:40
...
public static double[] Mercator2LonLat(double X, double Y)
{
double[] d = new double[2];
double x = X / 20037508.34 * 180;
double y = Y / 20037508.34 * 180;
y = 180 / Math.PI * (2 * Math.Atan(Math.Exp(y * Math.PI / 180)) - Math.PI / 2);
d[0] = x;
d[1] = y;
return d;
}
public static double[] LonLat2Mercator(double X, double Y)
{
double[] d = new double[2];
double x = X * 20037508.34 / 180;
double y = Math.Log(Math.Tan((90 + Y) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
d[0] = x;
d[1] = y;
return d;
}
上一篇: 购物网-->>订单模块中的几个实体
下一篇: antd mobile(二)高清方案配置
推荐阅读