Why reprojection GeoJSON with new.ol.View - not working?

83 Views Asked by At

I try to reproject Geojson file in OpenLayers 3 from:

 <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>

- With this code to set the new ol.View with 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);  
  • But after setting that new ol.View i see only white screen.

Where is the problem?

0

There are 0 best solutions below