在OpenLayers Map中更改投影 [英] Change Projection in OpenLayers Map

查看:640
本文介绍了在OpenLayers Map中更改投影的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将EPSG:4326设置为OpenLayers地图的投影,但是当我尝试时,我总是得到EPSG:900913。

I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913".

function init() {

    var options = {
            projection: new OpenLayers.Projection("EPSG:4326")  // ignored
    };

    map = new OpenLayers.Map('map', options);

    var layer = new OpenLayers.Layer.OSM.Osmarender("Osmarender");
    map.addLayer(layer);

    ...

    alert(map.getProjection());  // returns "EPSG:900913"

    ...

}

基本地图是开放的街道地图。

The base map is open street map.

如何将投影设置为EPSG:4326?

How can I set the Projection to EPSG:4326?

推荐答案

Osmarender有一个硬编码的900913投影,与此无关。但你有没有考虑过相反的事情?将坐标或图层转换为EPSG:900913?请查看此处的文档: http://docs.openlayers.org/library/spherical_mercator.html

It is Osmarender that has a hardcoded 900913 projection, nothing to do about that. But have you considered taking things the other way around? Transforming your coordinates or layer to EPSG:900913? Check the documentation here: http://docs.openlayers.org/library/spherical_mercator.html

这篇关于在OpenLayers Map中更改投影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆