For GCJ-02 and BD-09, see
Http://developer.baidu.com/map/question.htm#qa0043.
AlgorithmCodeAs shown in the following figure.Bd_encrypt
Convert GCJ-02 coordinates into BD-09 coordinates,Bd_decrypt
Otherwise.
# Include <math. h> const double x_pi = 3.14159265358979324*3000.0/180.0; void bd_encrypt (double gg_lat, double gg_lon, double & bd_lat, double & bd_lon) {Double X = gg_lon, y = gg_lat; double Z = SQRT (x * x + y * Y) + 0.00002 * sin (y * x_pi); double Theta = atan2 (Y, X) + 0.000003 * Cos (x * x_pi); bd_lon = z * Cos (theta) + 0.0065; bd_lat = z * sin (theta) + 0.006;} void bd_decrypt (double bd_lat, double bd_lon, double & gg_lat, double & gg_lon) {Double X = bd_lon-0.0065, y = bd_lat-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); gg_lon = z * Cos (theta ); gg_lat = z * sin (theta );}