//高德坐标转换百度坐标
gaoDeToBaidu(gd_lon, gd_lat) {
let PI = 3.14159265358979324 * 3000.0 / 180.0;
let x = gd_lon, y = gd_lat;
let z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * PI);
let theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * PI);
let lng = z * Math.cos(theta) + 0.0065;//经度
let lat = z * Math.sin(theta) + 0.006;//纬度
return {lng,lat};
}
附:百度和高德地图坐标拾取点,进行测试。
http://api.map.baidu.com/lbsapi/getpoint/index.html
https://lbs.amap.com/console/show/picker
网友评论