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 {
281
281
description : mapInfo . description
282
282
} ; //存储地图的名称以及描述等信息,返回给用户
283
283
284
- // 多坐标系支持
285
- if ( proj4 ) {
286
- ( olProj4 && olProj4 . register ) ? olProj4 . register ( proj4 ) : window . ol . proj . setProj4 ( proj4 ) ;
287
- }
288
284
// 目前iServer服务中可能出现的EPSG 0,-1,-1000
289
285
if ( mapInfo . projection . indexOf ( "EPSG" ) === 0 && mapInfo . projection . split ( ":" ) [ 1 ] <= 0 ) {
290
286
//对于这两种地图,只能view,不能叠加其他图层
@@ -3669,6 +3665,12 @@ export class WebMap extends Observable {
3669
3665
let epsgCode = this . getEpsgInfoFromWKT ( wkt ) ;
3670
3666
if ( epsgCode ) {
3671
3667
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
+ }
3672
3674
return true ;
3673
3675
} else {
3674
3676
// 参数类型非wkt标准
You can’t perform that action at this time.
0 commit comments