百度坐标转高德章

+(CLLocationCoordinate2D) GCJ02ToBd09:(CLLocationCoordinate2D) gcj{

const double x_pi = 3.14159265358979324 * 3000.0 / 180.0;

double x = gcj.longitude, y = gcj.latitude;

double z = sqrt(x * x + y * y) + 0.00002 * sin(y * x_pi);

double theta = atan2(y, x) + 0.000003 * cos(x * x_pi);

double lon = z * cos(theta) + 0.0065;

double lat = z * sin(theta) + 0.006;

return CLLocationCoordinate2DMake(lat, lon);

}

+(CLLocationCoordinate2D) Bd09ToGCJ02:(CLLocationCoordinate2D )bd

{

const

double x_pi = 3.14159265358979324 * 3000.0 / 180.0;

double x = bd.longitude - 0.0065, y = bd.latitude - 0.006;

double z = sqrt(x * x + y * y) - 0.00002 * sin(y * x_pi);

double theta = atan2(y, x) - 0.000003 * cos(x * x_pi);

CLLocationCoordinate2D reslt = CLLocationCoordinate2DMake(z * sin(theta), z * cos(theta));

return reslt;

}

你可能感兴趣的:(百度坐标转高德章)