//经纬度转Web墨卡托
Vector3 lonLat2WebMercator(Vector3 lonLat)
{
Vector3 mercator;
double x = lonLat.x *
20037508.34 /
180;
double y = log(tan((
90 + lonLat.y)*
3.14 /
360)) / (
3.14 /
180);
y = y *
20037508.34 /
180;
mercator.x =
x;
mercator.y =
y;
return mercator;
}
//Web墨卡托转经纬度
Vector3 WebMercator2lonLat(Vector3 mercator)
{
Vector3 lonLat;
double x = mercator.x /
20037508.34 *
180;
double y = mercator.y /
20037508.34 *
180;
y =
180 /
3.14*(
2 * atan(exp(y*
3.14 /
180)) -
3.14 /
2);
lonLat.x =
x;
lonLat.y =
y;
return lonLat;
}
转载于:https://www.cnblogs.com/lyggqm/p/11224779.html
相关资源:数据结构—成绩单生成器
转载请注明原文地址: https://mac.8miu.com/read-73668.html