Openlayers 3 OpenLayers GeoJson重投影

Openlayers 3 OpenLayers GeoJson重投影,openlayers-3,geojson,projection,Openlayers 3,Geojson,Projection,重新投影GeoJson的I热堆栈 我有一个由ajax从服务器加载的GeoJson对象 对象的CRS设置为EPSG:2180 我想把它叠加在有CRS的OpenStreet地图上,EPSG:3857 var buildingsFeatures = (new ol.format.GeoJSON()).readFeatures($buildings, { dataProjection: 'EPSG:2180', featureProjection: 'EPSG:3857'

重新投影GeoJson的I热堆栈 我有一个由ajax从服务器加载的GeoJson对象
对象的CRS设置为EPSG:2180
我想把它叠加在有CRS的OpenStreet地图上,EPSG:3857

var buildingsFeatures = (new ol.format.GeoJSON()).readFeatures($buildings, {
        dataProjection: 'EPSG:2180',
        featureProjection: 'EPSG:3857'
    });
$buildingGeoJson FeatureCollection对象,上述代码符合OpenLayers文档,但坐标未更改。


我用它撞墙了:(

让它工作起来需要做的事情:


  • 在代码内部或proj4-defs.js文件中将EPSG:2180定义为
proj4.defs([ [ ‘EPSG:2180’, “+proj=tmerc+lat_0=0+lon_0=19+k=0.9993+x_0=500000+y_0=-5300000+ellps=GRS80+units=m+no_defs” ] ]))


仅此而已。

要使其正常工作,需要做的事情:


  • 在代码内部或proj4-defs.js文件中将EPSG:2180定义为
proj4.defs([ [ ‘EPSG:2180’, “+proj=tmerc+lat_0=0+lon_0=19+k=0.9993+x_0=500000+y_0=-5300000+ellps=GRS80+units=m+no_defs” ] ]))

就这些