Skip to content

Commit a1ff70e

Browse files
committed
fix: use dummy layer for erroneous WMTS layers
1 parent dfe6852 commit a1ff70e

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/parser/SHOGunApplicationUtil.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,31 @@ class SHOGunApplicationUtil<
283283
}
284284

285285
if (layer.type === 'WMTS') {
286-
return await this.parseWMTSLayer(layer, projection);
286+
try {
287+
return await this.parseWMTSLayer(layer, projection);
288+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
289+
} catch (error) {
290+
const wmtsSource = new OlSourceWMTS({
291+
layer: layer?.sourceConfig?.layerNames,
292+
matrixSet: 'dummyMatrixSet',
293+
style: 'dummyStyle',
294+
tileGrid: new OlTileGridWMTS({
295+
matrixIds: [],
296+
resolutions: [],
297+
origin: [0, 0]
298+
})
299+
});
300+
301+
const dummyLayer = new OlTileLayer({
302+
source: wmtsSource
303+
});
304+
305+
this.setLayerProperties(dummyLayer, layer);
306+
307+
Logger.warn('Returning dummy WMTS layer as capabilities could not be requested.');
308+
309+
return dummyLayer;
310+
}
287311
}
288312

289313
if (layer.type === 'WFS') {

0 commit comments

Comments
 (0)