@@ -4525,10 +4525,14 @@ export class WebMap extends Observable {
4525
4525
let dataSource = layerInfo . dataSource ;
4526
4526
let url = dataSource . url ;
4527
4527
if ( this . isRestMapMapboxStyle ( layerInfo ) ) {
4528
- url = url . replace ( restMapMVTStr , '' )
4528
+ url = url . replace ( restMapMVTStr , '' ) ;
4529
+ url = this . getRequestUrl ( url + '.json' ) ;
4530
+ }
4531
+ if ( url . indexOf ( '/restjsr/' ) > - 1 && ! / \. j s o n $ / . test ( url ) ) {
4532
+ url = this . getRequestUrl ( url + '.json' ) ;
4533
+ } else {
4534
+ url = this . getRequestUrl ( url ) ;
4529
4535
}
4530
- url = this . getRequestUrl ( url + '.json' )
4531
-
4532
4536
let credential = layerInfo . credential ;
4533
4537
let credentialValue , keyfix ;
4534
4538
//携带令牌(restmap用的首字母大写,但是这里要用小写)
@@ -4548,10 +4552,23 @@ export class WebMap extends Observable {
4548
4552
return response . json ( ) ;
4549
4553
} ) . then ( ( result ) => {
4550
4554
layerInfo . visibleScales = result . visibleScales ;
4551
- layerInfo . coordUnit = result . coordUnit ;
4555
+ layerInfo . coordUnit = result . coordUnit || 'METER' ;
4552
4556
layerInfo . scale = result . scale ;
4553
- layerInfo . epsgCode = result . prjCoordSys . epsgCode ;
4554
- layerInfo . bounds = result . bounds ;
4557
+ layerInfo . epsgCode = ( result . prjCoordSys && result . prjCoordSys . epsgCode ) || '3857' ;
4558
+ layerInfo . bounds = result . bounds || {
4559
+ top : 20037508.342789244 ,
4560
+ left : - 20037508.342789244 ,
4561
+ bottom : - 20037508.342789244 ,
4562
+ leftBottom : {
4563
+ x : - 20037508.342789244 ,
4564
+ y : - 20037508.342789244
4565
+ } ,
4566
+ right : 20037508.342789244 ,
4567
+ rightTop : {
4568
+ x : 20037508.342789244 ,
4569
+ y : 20037508.342789244
4570
+ }
4571
+ } ;
4555
4572
return layerInfo ;
4556
4573
} ) . catch ( error => {
4557
4574
throw error ;
@@ -4571,7 +4588,7 @@ export class WebMap extends Observable {
4571
4588
let _this = this ;
4572
4589
let url = layerInfo . url || layerInfo . dataSource . url ;
4573
4590
let styleUrl = url ;
4574
- if ( styleUrl . indexOf ( '/restjsr/' ) > - 1 ) {
4591
+ if ( styleUrl . indexOf ( '/restjsr/' ) > - 1 && ! / \/ s t y l e \. j s o n $ / . test ( url ) ) {
4575
4592
styleUrl = `${ styleUrl } /style.json` ;
4576
4593
}
4577
4594
styleUrl = this . getRequestUrl ( styleUrl )
0 commit comments