火星坐标转换成百度坐标

static final double x_pi = 3.14159265358979324 * 3000.0 / 180.0;
public static class Pos {
   public double lat;
   public double lon;
}
public static Pos bd_encrypt(Pos pos) {
   Pos result = new Pos();
   double x = pos.lon, y = pos.lat; 
   double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); 
   
   double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); 
   
   result.lon = z * Math.cos(theta) + 0.0065; 
   result.lat = z * Math.sin(theta) + 0.006; 
   return result;
}


你可能感兴趣的:(android,地图)