API |
坐标系 |
|
百度地图API |
百度坐标 |
|
腾讯搜搜地图API |
火星坐标 |
|
搜狐搜狗地图API |
搜狗坐标* |
|
阿里云地图API |
图吧MapBar地图API |
图吧坐标 |
高德MapABC地图API |
灵图51ditu地图API |
火星坐标 |
class func bd_encrypt(gg_lat:Double,gg_lon: Double) -> (bd_lat:Double,bd_lon: Double) {
var x = gg_lon;
var y = gg_lat;
var z =sqrt(x * x + y * y) + 0.00002 * sin(y * x_pi);
var theta =atan2(y,x) + 0.000003 * cos(x * x_pi);
var bdlon = z *cos(theta) + 0.0065;
var bdlat = z *sin(theta) + 0.006;
return (bdlat,bdlon)
}
classfunc bd_decrypt(bd_lat: Double,bd_lon:Double) -> (gg_lat: Double,gg_lon:Double) {
var x = bd_lon - 0.0065;
var y = bd_lat - 0.006;
var z =sqrt(x * x + y * y) - 0.00002 * sin(y * x_pi);
var theta =atan2(y,x) - 0.000003 * cos(x * x_pi);
var gglon = z *cos(theta);
var gglat = z *sin(theta);
return (gglat,gglon)
}
原文链接:https://www.f2er.com/swift/326362.html