File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -281,10 +281,6 @@ export class WebMap extends Observable {
281281 description : mapInfo . description
282282 } ; //存储地图的名称以及描述等信息,返回给用户
283283
284- // 多坐标系支持
285- if ( proj4 ) {
286- ( olProj4 && olProj4 . register ) ? olProj4 . register ( proj4 ) : window . ol . proj . setProj4 ( proj4 ) ;
287- }
288284 // 目前iServer服务中可能出现的EPSG 0,-1,-1000
289285 if ( mapInfo . projection . indexOf ( "EPSG" ) === 0 && mapInfo . projection . split ( ":" ) [ 1 ] <= 0 ) {
290286 //对于这两种地图,只能view,不能叠加其他图层
@@ -3669,6 +3665,12 @@ export class WebMap extends Observable {
36693665 let epsgCode = this . getEpsgInfoFromWKT ( wkt ) ;
36703666 if ( epsgCode ) {
36713667 proj4 . defs ( epsgCode , wkt ) ;
3668+ // 重新注册proj4到ol.proj,不然不会生效
3669+ if ( olProj4 && olProj4 . register ) {
3670+ olProj4 . register ( proj4 ) ;
3671+ } else if ( window . ol . proj && window . ol . proj . setProj4 ) {
3672+ window . ol . proj . setProj4 ( proj4 )
3673+ }
36723674 return true ;
36733675 } else {
36743676 // 参数类型非wkt标准
You can’t perform that action at this time.
0 commit comments