我的 map 使用 EPSG:900013 投影。结果,在获取鼠标位置时,我得到的值以米为单位,范围为 -20037508.342789244 到 20037508.342789244。
我使用了 LonLat 类的 .transform() 方法,使用 EPSG:900913 作为源投影,并且(没有考虑)使用 EPSG:4329 作为目标投影。
我的问题是,为什么 EPSG:4329 给我的范围是 -180、180、-80.05、85.05(我想要的)而不是 -180、180、-90、90(它应该给我的,因为这些是正确的界限 http://spatialreference.org/ref/epsg/wgs-84/ )?
最佳答案
我相对确定您的源投影 (900913) 正在设置这些限制,因此当您移动鼠标时,您只能移动距离 0,0 这么多米,这对应于 85.05 和 -80.05在你的转变中。
换句话说,EPSG 900913 并不涵盖整个地球。因此,当您分别将鼠标移动到最远的北/南时,它不会转换为 +/- 90,而是转换为 85.05 和 -80.05,如您所见。
如果你去检查this page in the OpenLayers docs ,他们解释如下:
Specifically, most spherical mercator maps use an extent of the world from -180 to 180 longitude, and from -85.0511 to 85.0511 latitude. Because the mercator projection stretches to infinity as you approach the poles, a cutoff in the north-south direction is required, and this particular cutoff results in a perfect square of projected meters.
关于javascript - OpenLayers LonLat 转换不在正确的投影范围内,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22823285/