@@ -368,7 +368,7 @@ export class WebMap extends Observable {
368368 let that = this , handleResult = { } ;
369369 let newCrs = crs , action = "OpenMap" ;
370370
371- if ( crs === "EPSG:-1" ) {
371+ if ( this . isCustomProjection ( crs ) ) {
372372 // 去iServer请求wkt 否则只能预览出图
373373 await FetchRequest . get ( that . getRequestUrl ( `${ baseLayerUrl } /prjCoordSys.wkt` ) , null , {
374374 withCredentials : that . withCredentials ,
@@ -377,7 +377,7 @@ export class WebMap extends Observable {
377377 return response . text ( ) ;
378378 } ) . then ( async function ( result ) {
379379 if ( result . indexOf ( "<!doctype html>" ) === - 1 ) {
380- that . addProjctionFromWKT ( result , "EPSG:-1" ) ;
380+ that . addProjctionFromWKT ( result , crs ) ;
381381 handleResult = { action, newCrs} ;
382382 } else {
383383 throw 'ERROR' ;
@@ -1140,7 +1140,7 @@ export class WebMap extends Observable {
11401140 // prjCoordSys: {epsgCode: isBaseLayer ? layerInfo.projection.split(':')[1] : this.baseProjection.split(':')[1]},
11411141 format : layerInfo . format
11421142 } ;
1143- if ( ! isBaseLayer && this . baseProjection !== "EPSG:-1" ) {
1143+ if ( ! isBaseLayer && ! this . isCustomProjection ( this . baseProjection ) ) {
11441144 options . prjCoordSys = { epsgCode : this . baseProjection . split ( ':' ) [ 1 ] } ;
11451145 }
11461146 if ( layerInfo . visibleScales && layerInfo . visibleScales . length > 0 ) {
@@ -1343,7 +1343,7 @@ export class WebMap extends Observable {
13431343 let projection = {
13441344 epsgCode : that . baseProjection . split ( ":" ) [ 1 ]
13451345 }
1346- if ( that . baseProjection !== "EPSG:-1" ) {
1346+ if ( ! that . isCustomProjection ( that . baseProjection ) ) {
13471347 // bug IE11 不会自动编码
13481348 url += '.json?prjCoordSys=' + encodeURI ( JSON . stringify ( projection ) ) ;
13491349 }
@@ -5122,4 +5122,10 @@ export class WebMap extends Observable {
51225122 }
51235123 return lang ;
51245124 }
5125+ isCustomProjection ( projection ) {
5126+ if ( Util . isNumber ( projection ) ) {
5127+ return [ - 1000 , - 1 ] . includes ( + projection )
5128+ }
5129+ return [ 'EPSG:-1000' , 'EPSG:-1' ] . includes ( projection ) ;
5130+ }
51255131}
0 commit comments