我有以下示例在我的计算机上工作:
http://openlayers.org/en/v3.13.1/examples/mouse-position.html
但是,当我将代码更改为使用EPSG:27700而不是4326或3857时,一个非常简单的更改:
var mousePositionControl = new ol.control.MousePosition({
coordinateFormat: ol.coordinate.createStringXY(4),
// comment the following two lines to have the mouse position
// be placed within the map.
projection:'EPSG:27700',
className: 'custom-mouse-position',
target: document.getElementById('mouse-position'),
undefinedHTML: ' '
});...it似乎不承认EPSG:27700,默认为3857。
我试图通过在顶部添加以下内容来添加proj4js库:
<script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js"></script>正如我想的那样,OL3在其默认数据库中可能没有这个投影,但是它仍然不能工作。
发布于 2016-02-19 14:05:12
看起来这些是Proj4.js中唯一的预定义预测
instead of writing out the whole proj definition, by default proj4 has the following projections predefined:
'EPSG:4326', which has the following alias
'WGS84'
'EPSG:4269'
'EPSG:3857', which has the following aliases
'EPSG:3785'
'GOOGLE'
'EPSG:900913'
'EPSG:102113'稍微谷歌一下,您就可以这样添加它:
Proj4js.defs["EPSG:27700"] = "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs";
EPSG27700 = new OpenLayers.Projection( "EPSG:27700" );https://stackoverflow.com/questions/35506790
复制相似问题