1- // Imports
2- // @ts -expect-error
3- import { _WMSLayer as DeckWMSLayer } from '@deck.gl/geo-layers' ;
1+ // SPDX-License-Identifier: MIT
2+ // Copyright contributors to the kepler.gl project
3+
44import {
55 Field ,
66 LayerBaseConfig ,
@@ -11,13 +11,16 @@ import {
1111import TileDataset from '../vector-tile/common-tile/tile-dataset' ;
1212import WMSLayerIcon from './wms-layer-icon' ;
1313import { FindDefaultLayerPropsReturnValue } from '../layer-utils' ;
14- import { DatasetType , LAYER_TYPES } from '@kepler.gl/constants' ;
15- import { KeplerTable as KeplerDataset } from '@kepler.gl/table' ;
14+
1615import AbstractTileLayer , {
1716 AbstractTileLayerVisConfigSettings ,
1817 LayerData
1918} from '../vector-tile/abstract-tile-layer' ;
19+
20+ import { DatasetType , LAYER_TYPES } from '@kepler.gl/constants' ;
2021import { notNullorUndefined } from '@kepler.gl/common-utils' ;
22+ import { WMSLayer as DeckWMSLayer } from '@kepler.gl/deckgl-layers' ;
23+ import { KeplerTable as KeplerDataset } from '@kepler.gl/table' ;
2124
2225// Types
2326export type WMSTile = {
@@ -36,6 +39,7 @@ export type WMSLayerVisConfig = {
3639 wmsLayer : {
3740 name : string ;
3841 title : string ;
42+ boundingBox : number [ ] [ ] ;
3943 } ;
4044} ;
4145
@@ -78,7 +82,7 @@ export default class WMSLayer extends AbstractTileLayer<WMSTile, any[]> {
7882 this . updateLayerVisConfig ( {
7983 opacity : 0.8 , // Default opacity
8084 wmsLayer : defaultWmsLayer ,
81- transparent : false
85+ transparent : true
8286 } ) ;
8387 }
8488
@@ -148,6 +152,25 @@ export default class WMSLayer extends AbstractTileLayer<WMSTile, any[]> {
148152 } ;
149153 }
150154
155+ _getCurrentServiceLayer ( dataset : KeplerDataset ) {
156+ const { visConfig} = this . config ;
157+ return visConfig . wmsLayer ?? dataset . metadata ?. layers ?. [ 0 ] ?? null ;
158+ }
159+
160+ updateLayerMeta ( dataset : KeplerDataset ) : void {
161+ if ( dataset . type !== DatasetType . WMS_TILE ) {
162+ return ;
163+ }
164+
165+ const currentLayer = this . _getCurrentServiceLayer ( dataset ) ;
166+ if ( currentLayer && currentLayer . boundingBox ) {
167+ const bb = currentLayer . boundingBox ;
168+ this . updateMeta ( {
169+ bounds : [ bb [ 0 ] [ 0 ] , bb [ 0 ] [ 1 ] , bb [ 1 ] [ 0 ] , bb [ 1 ] [ 1 ] ]
170+ } ) ;
171+ }
172+ }
173+
151174 renderLayer ( opts ) {
152175 const { visConfig} = this . config ;
153176 const { data} = opts ;
0 commit comments