Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wgs2gcj 代码注释上的建议 #41

Open
Artoria2e5 opened this issue Dec 19, 2016 · 1 comment
Open

wgs2gcj 代码注释上的建议 #41

Artoria2e5 opened this issue Dec 19, 2016 · 1 comment

Comments

@Artoria2e5
Copy link
Contributor

Artoria2e5 commented Dec 19, 2016

今天重新看了一下 wgs→gcj 里面对于 transform() 一滩浑水之后的两个数值的处理:

	d.lat = (d.lat * 180.0) / ((earthR * (1 - ee)) / (magic * sqrtMagic) * Math.PI);
	d.lng = (d.lng * 180.0) / (earthR / sqrtMagic * Math.cos(radLat) * Math.PI);

这边实际上是进行了这样的操作

// https://en.wikipedia.org/wiki/Latitude#Length_of_a_degree_of_latitude
d.lat /= 椭球体纬线1°弧长({纬度: lat})
// https://en.wikipedia.org/wiki/Longitude#Length_of_a_degree_of_longitude
d.lon /= 椭球体经线1°弧长({纬度: lat})

如果感兴趣的话可以加上注释说明。能得到的一个比较有意思的结论是可以从 GCJ 的 transform 函数中直接得到经纬方向上加偏的距离,以及 transform 这个步骤的返回变量可以尝试说明单位是米。

@googollee
Copy link
Owner

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants