32 lines
1013 B
Plaintext
32 lines
1013 B
Plaintext
package com.sercurityControl.proteam.util;
|
|
|
|
/**
|
|
* 奥维坐标 转 百度地图
|
|
*/
|
|
public class JWDUtils {
|
|
|
|
|
|
public static void main(String[] args) {
|
|
double oviLng = 115.85574333; // 输入奥维经度
|
|
double oviLat = 30.68280057; // 输入奥维纬度
|
|
convertOviToBaidu(oviLng, oviLat);
|
|
Double[] msg=CoordinateConversion.wgs84tobd09(oviLng,oviLat);
|
|
System.err.println(msg[0]);
|
|
System.err.println(msg[1]);
|
|
}
|
|
|
|
private static void convertOviToBaidu(double lng, double lat) {
|
|
double xpi = 3.14159265358979324 * 3000.0 / 180.0;
|
|
double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * xpi);
|
|
double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * xpi);
|
|
double bdLng = z * Math.cos(theta) + 0.0065;
|
|
double bdLat = z * Math.sin(theta) + 0.006;
|
|
System.err.println(bdLng);
|
|
System.err.println(bdLat);
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|