|
@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
|
|
@Component
|
|
@Component
|
|
public class GpsUtil {
|
|
public class GpsUtil {
|
|
public static final String BAIDU_LBS_TYPE = "bd09ll";
|
|
public static final String BAIDU_LBS_TYPE = "bd09ll";
|
|
public static double pi = 3.1415926535897932384626;
|
|
|
|
|
|
public static double pi = Math.PI;
|
|
public static double a = 6378245.0;
|
|
public static double a = 6378245.0;
|
|
public static double ee = 0.00669342162296594323;
|
|
public static double ee = 0.00669342162296594323;
|
|
|
|
|
|
@ -95,7 +95,7 @@ public class GpsUtil {
|
|
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
|
double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
|
double gg_lon = z * Math.cos(theta);
|
|
double gg_lon = z * Math.cos(theta);
|
|
double gg_lat = z * Math.sin(theta);
|
|
double gg_lat = z * Math.sin(theta);
|
|
return bd_lon+","+bd_lat;
|
|
|
|
|
|
return gg_lon+","+gg_lat;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@ -170,4 +170,29 @@ public class GpsUtil {
|
|
result.put("lon",lon);
|
|
result.put("lon",lon);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// /**
|
|
|
|
// * 百度转火星
|
|
|
|
// * @param bd_lat
|
|
|
|
// * @param bd_lon
|
|
|
|
// */
|
|
|
|
// public static String bd_decrypt(double bd_lat, double bd_lon)
|
|
|
|
// {
|
|
|
|
// double x = bd_lon - 0.0065, y = bd_lat - 0.006;
|
|
|
|
// double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * pi);
|
|
|
|
// double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * pi);
|
|
|
|
// double gg_lon = z * Math.cos(theta);
|
|
|
|
// double gg_lat = z * Math.sin(theta);
|
|
|
|
// return gg_lat+","+gg_lon;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// public static String bd_encrypt(double gg_lat, double gg_lon) {
|
|
|
|
// double x = gg_lon, y = gg_lat;
|
|
|
|
// double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * pi);
|
|
|
|
// double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * pi);
|
|
|
|
// double bd_lon = z * Math.cos(theta) + 0.0065;
|
|
|
|
// double bd_lat = z * Math.sin(theta) + 0.006;
|
|
|
|
// return bd_lat + "," + bd_lon;
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
}
|