Skip to content

Commit

Permalink
Merge pull request #4137 from rldhont/fix-wmts-options-null-tile-layer
Browse files Browse the repository at this point in the history
[Bugfix] Build WMTS options return null
  • Loading branch information
rldhont authored Feb 1, 2024
2 parents 29eb616 + c93f3a6 commit 47ea812
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions assets/src/modules/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,20 +180,34 @@ export default class map extends olMap {
let minResolution = node.wmsMinScaleDenominator <= 1 ? undefined : Utils.getResolutionFromScale(node.layerConfig.minScale, metersPerUnit);
let maxResolution = node.wmsMaxScaleDenominator <= 1 ? undefined : Utils.getResolutionFromScale(node.layerConfig.maxScale, metersPerUnit);

// The layer is configured to be cached
if (node.layerConfig.cached) {
// Using WMTS
const parser = new WMTSCapabilities();
const result = parser.read(lizMap.wmtsCapabilities);
const options = optionsFromCapabilities(result, {
layer: node.wmsName,
matrixSet: mainLizmap.projection,
});

layer = new TileLayer({
minResolution: minResolution,
maxResolution: maxResolution,
source: new WMTS(options)
});
} else {
// Build WMTS options
let options;
if (result['Contents']['Layer']) {
options = optionsFromCapabilities(result, {
layer: node.wmsName,
matrixSet: mainLizmap.projection,
});
}

// The options could be null if the layer has not be found in
// WMTS capabilities
if (options) {
layer = new TileLayer({
minResolution: minResolution,
maxResolution: maxResolution,
source: new WMTS(options)
});
}
}

// The layer has not been yet build
if (!layer) {
layer = new ImageLayer({
// extent: extent,
minResolution: minResolution,
Expand Down

0 comments on commit 47ea812

Please sign in to comment.