Baidu turns to Mars
-(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;
}
Other coordinates go to Baidu coordinate system
Cllocationcoordinate2d test = Cllocationcoordinate2dmake (Location.coordinate.latitude, Location.coordinate.longitude);
Convert Google Maps, Soso maps, Aliyun maps, MAPABC maps, and AMAP map coordinates to Baidu coordinates
nsdictionary* testdic = Bmkconvertbaiducoorfrom (Test,bmk_coordtype_common);
Convert GPS coordinates to Baidu coordinates
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"]];
Conversion between Baidu map coordinate system and Mars coordinate system