我尝试从以下位置重新投影OpenLayers 3中的Geojson文件:
<link rel="stylesheet" href="http://openlayers.org/en/v3.15.1/css/ol.css" type="text/css">
<script src="http://openlayers.org/en/v3.15.1/build/ol.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/proj4js/2.2.1/proj4.js"></script>
- 使用此代码设置新的ol.View newProjCode:
var newProjCode = 'EPSG:27700'
proj4.defs(newProjCode, '+proj=utm +zone=31 +ellps=WGS84 +datum=WGS84 +units=m +no_defs');
var newProj = ol.proj.get(newProjCode);
var fromLonLat = ol.proj.getTransform('EPSG:4326', newProj);
var newView = new ol.View({
projection: newProj
});
map.setView(newView);
问题出在哪里?