Map高纬度转换-地图拉伸问题

  高纬度时单位长度转换需要有高斯投影运算,不运算地图在高纬度地区会被拉伸:

1     //Handle the problem of coordinate projection offset in high-latitude regions
2     private func metersToLatLng(lat: Double, lng: Double, dx: Double, dy: Double)-> CLLocationCoordinate2D {
3         let PI = 3.14
4         let earthRadius = 6378137.0 // The semi-major axis of WGS84 ellipsoid
5         let dLat = dy / earthRadius * (180 / PI)
6         let dLon = dx / (earthRadius * cos(lat * PI / 180)) * (180 / PI)
7         return CLLocationCoordinate2D(latitude: lat + dLat, longitude: lng + dLon)
8     }
View Code

  使用代码上的算法计算真实的坐标。

posted @ 2025-07-23 10:58  醉梦ai天涯  阅读(9)  评论(0)    收藏  举报