var
x =
this.
points[
i].
lng,
y =
this.
points[
i].
lat;
var
z =
Math.
sqrt(
x *
x +
y *
y) +
0.00002 *
Math.
sin(
y *
3.14159265358979324 *
3000.0 /
180.0)
var
theta =
Math.
atan2(
y,
x) +
0.000003 *
Math.
cos(
x *
3.14159265358979324 *
3000.0 /
180.0)
this.
points[
i].
lng =
z *
Math.
cos(
theta) +
0.0130;
this.
points[
i].
lat =
z *
Math.
sin(
theta) +
0.007;
这个算法是借鉴的 然后自己改了改坐标偏移
x和y是拿到的gps经纬度
结果发现请求到百度接口的时候
http://api.map.baidu.com/geoconv/v1/?coords=114.21892734521,29.575429778924&from=1&to=5&ak=你的密钥 //GET请求
返回来的百度经纬度和这个算法的经纬度基本一致 所以我推算出 在请求组百度接口的时候 百度也是在用这个算法进行计算的然后在返回来算好的数据