googollee / eviltransform

Transport coordinate between earth(WGS-84) and mars in china(GCJ-02).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BD 算法偏移系数有误

Artoria2e5 opened this issue · comments

BD 的原始泄出实现中有一个 x_pi 变量,指的是 3000 / 180 * Math.PI,eviltransform 抄过来变成了 Math.PI

想要测试的话尽管上 http://lbsyun.baidu.com/index.php?title=webapi/guide/changeposition 去比。

BD应该是别人贡献的,我开始的时候并没有打算包含BD的算法实现。毕竟百度的东西,没人支持也就没人用了对吧。

我确认一下这个

I saw this issue in the python implementation. Are there some good test Points I can be used for testing wgs to bd? I get too large of errors in the current test data I just want to make sure it's ok

Nah just use the constant in https://github.com/Artoria2e5/PRCoords/blob/05d1c12/js/PRCoords.js#L145-L158. It's really just pi times 3000: they missed the 3000. Play around in https://artoria2e5.github.io/PRCoords/demo if you want to.

And since you are doing a Matlab implementation, I strongly recommend that you read caijun's R implementation at https://github.com/caijun/geoChina. Solid work by, well, a math-y R programmer I guess.

Changing pi to X_PI did reduce the error rate (See testcases at https://gist.github.com/w1ndy/5236bca0654f472c8cffa038406441ed). I've fixed the python implementation and released a new package.

Before:

Encryption: Lat RMSE 0.000330, Lng RMSE 0.000091; Decryption: Lat RMSE 0.000330, Lng RMSE 0.000091

After:

Encryption: Lat RMSE 0.000000, Lng RMSE 0.000000; Decryption: Lat RMSE 0.000001, Lng RMSE 0.000000