//经纬度转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; }