标签:
// 百度转火星
-(CLLocationCoordinate2D)hhTrans_GCGPS:(CLLocationCoordinate2D)baiduGps
{
CLLocationCoordinate2D googleGps;
double bd_x=baiduGps.longitude - 0.0065;
double bd_y=baiduGps.latitude - 0.006;
double z = sqrt(bd_x * bd_x + bd_y * bd_y) - 0.00002 * sin(bd_y * M_PI);
double theta = atan2(bd_y, bd_x) - 0.000003 * cos(bd_x * M_PI);
googleGps.longitude = z * cos(theta);
googleGps.latitude = z * sin(theta);
return googleGps;
}
其他坐标转百度坐标系
CLLocationCoordinate2D test = CLLocationCoordinate2DMake(location.coordinate.latitude, location.coordinate.longitude);
//转换 google地图、soso地图、aliyun地图、mapabc地图和amap地图所用坐标至百度坐标
NSDictionary* testdic = BMKConvertBaiduCoorFrom(test,BMK_COORDTYPE_COMMON);
//转换GPS坐标至百度坐标
testdic = BMKConvertBaiduCoorFrom(test,BMK_COORDTYPE_GPS);
NSLog(@"x=%f,y=%f",location.coordinate.latitude,location.coordinate.longitude);
NSLog(@"x=%@,y=%@",[testdic objectForKey:@"x"],[testdic objectForKey:@"y"]);
NSString *lat = [MCEncryption base64FromBase64String:[testdic objectForKey:@"x"]] ;
NSString *lon = [MCEncryption base64FromBase64String:[testdic objectForKey:@"y"]] ;
标签:
原文地址:http://www.cnblogs.com/mglttkx/p/5522856.html