百度地图坐标与苹果自带地图经纬度之间的相互转换方法
作者:
SMFly | 来源:发表于
2016-08-12 08:01 被阅读293次
- 百度坐标转高德坐标
+ (CLLocationCoordinate2D)GCJ02FromBD09:(CLLocationCoordinate2D)coor{
CLLocationDegrees x_pi =3.141592653589793243000.0/180.0;
CLLocationDegrees x = coor.longitude -0.0065, y = coor.latitude -0.006;
CLLocationDegrees z =sqrt(x * x + y * y) -0.00002sin(y * x_pi);
CLLocationDegrees theta =atan2(y, x) -0.000003*cos(x * x_pi);
CLLocationDegrees gg_lon = z *cos(theta);
CLLocationDegrees gg_lat = z *sin(theta);
returnCLLocationCoordinate2DMake(gg_lat, gg_lon);
}
- 高德坐标转百度坐标
+ (CLLocationCoordinate2D)BD09FromGCJ02: (CLLocationCoordinate2D)coor{
CLLocationDegrees x_pi =3.141592653589793243000.0/180.0;
CLLocationDegrees x = coor.longitude, y = coor.latitude;
CLLocationDegrees z =sqrt(x * x + y * y) +0.00002sin(y * x_pi);
CLLocationDegrees theta =atan2(y, x) +0.000003*cos(x * x_pi);
CLLocationDegrees bd_lon = z *cos(theta) +0.0065;
CLLocationDegrees bd_lat = z *sin(theta) +0.006;
return CLLocationCoordinate2DMake(bd_lat, bd_lon);
}
本文标题:百度地图坐标与苹果自带地图经纬度之间的相互转换方法
本文链接:https://www.haomeiwen.com/subject/dxwssttx.html
网友评论