openlayers设置为4490坐标系
使用TileSupermapRest叠加iserver上发布的4490地图服务会报错:
Cannot read property 'getOrigin' of null
proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs"); ol.proj.proj4 && ol.proj.proj4.register(proj4); var proj1=new ol.proj.Projection({ code:"EPSG:4490", units:"degrees", }) ol.proj.addProjection(proj1); ol.proj.addCoordinateTransforms("EPSG:4326","EPSG:4490", function(coordinate){ return(proj4("EPSG:4326","EPSG:4490",coordinate)) }, function(coordinate){ return(proj4("EPSG:4490","EPSG:4326",coordinate)) } ) var proj4490=new ol.proj.get("EPSG:4490") var map, url = "http://localhost:8090/iserver/services/map-4490/rest/maps/New_Region@test"; var map = new ol.Map({ target: 'map', controls: ol.control.defaults({ attributionOptions: { collapsed: false } }) .extend([new ol.supermap.control.Logo()]), view: new ol.View({ center: [-21.13 , 21.63], zoom: 2, projection: proj4490 }) }); // 添加图层 var layer = new ol.layer.Tile({ source: new ol.source.TileSuperMapRest({ url: url, wrapX: true }), projection: proj4490 }); map.addLayer(layer);