经纬度和墨卡托互相转换
1 //经纬度转墨卡托 2 public Vector2D lonLat2Mercator(Vector2D lonLat){ 3 Vector2D mercator = new Vector2D(); 4 double x = lonLat.X * 20037508.34 / 180; 5 double y = Math.Log(Math.Tan((90 + lonLat.Y) * Math.PI / 360)) / (Math.PI / 180); 6 y = y * 20037508.34 / 180; 7 mercator.X = x; 8 mercator.Y = y; 9 return mercator; 10 } 11 //墨卡托转经纬度 12 public Vector2D Mercator2lonLat(Vector2D mercator){ 13 Vector2D lonLat = new Vector2D(); 14 double x = mercator.X / 20037508.34 * 180; 15 double y = mercator.Y / 20037508.34 * 180; 16 y = 180 / Math.PI * (2 * Math.Atan(Math.Exp(y * Math.PI / 180)) - Math.PI / 2); 17 lonLat.X = x; 18 lonLat.Y = y; 19 return lonLat; 20 }
做你说过的 说你能做的;

浙公网安备 33010602011771号