OpenLayers - 墨卡托投影,带十进制度纬度/经度单位
我正在使用 OpenLayers 显示与 Google 地图、Bing 等具有相同投影的地图(即方形墨卡托地图)。据我了解,要启用此投影,我需要使用 sphericalMercator 标志。然而,这似乎也改变了 LonLat 方法等使用的单位,因此我必须从十进制度转换为米。
有没有办法可以使用墨卡托投影,但仍使用十进制度数来指定地图上的位置?
谢谢。
I'm using OpenLayers to display a map of the same projection as Google Maps, Bing, etc. (that is, a square Mercator map). As I understand it, to enable this projection, I need to use the sphericalMercator flag. However, this also appears to change the units used by the LonLat method, etc. such that I have to transform from decimal degrees to metres.
Is there a way I can use the Mercator projection, but still use decimal degrees in order to specify positions on the map?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
取决于“在地图上指定位置”的含义:如果您想添加标记、矢量特征等,则必须重新投影它们的坐标,但您可以执行 OpenLayers 内的。
如果您只想以“只读方式”指定位置(例如,在特定坐标系中使用 MousePosition 控件显示当前鼠标位置),则只需指定 地图的“displayProjection”参数。
Depends what you mean by "specifying positions on the map": if you want to add Markers, Vector Features etc., you have to re-project their coordinates, but you can do that within OpenLayers.
If you just want specify positions in a "read-only way" (e.g. displaying the current mouse position with the MousePosition Control in a certain coordinate system), you can do so by simply specifying the "displayProjection" parameter of the map.