diff --git a/web/client/components/map/openlayers/plugins/WMSLayer.js b/web/client/components/map/openlayers/plugins/WMSLayer.js index 20d3e3fb5c..49d00ada04 100644 --- a/web/client/components/map/openlayers/plugins/WMSLayer.js +++ b/web/client/components/map/openlayers/plugins/WMSLayer.js @@ -179,6 +179,7 @@ const mustCreateNewLayer = (oldOptions, newOptions) => { || oldOptions.localizedLayerStyles !== newOptions.localizedLayerStyles || oldOptions.tileSize !== newOptions.tileSize || oldOptions.forceProxy !== newOptions.forceProxy + || oldOptions.url !== newOptions.url || oldOptions.tileGridStrategy !== newOptions.tileGridStrategy || !isEqual(oldOptions.tileGrids, newOptions.tileGrids) ); diff --git a/web/client/components/map/openlayers/plugins/WMTSLayer.js b/web/client/components/map/openlayers/plugins/WMTSLayer.js index 63544c941c..6e8e7d6698 100644 --- a/web/client/components/map/openlayers/plugins/WMTSLayer.js +++ b/web/client/components/map/openlayers/plugins/WMTSLayer.js @@ -165,6 +165,7 @@ const updateLayer = (layer, newOptions, oldOptions) => { || oldOptions.srs !== newOptions.srs || oldOptions.format !== newOptions.format || oldOptions.style !== newOptions.style + || oldOptions.url !== newOptions.url || oldOptions.credits !== newOptions.credits) { return createLayer(newOptions); } diff --git a/web/client/utils/LayersUtils.js b/web/client/utils/LayersUtils.js index 09438d372c..4f3a7c30ae 100644 --- a/web/client/utils/LayersUtils.js +++ b/web/client/utils/LayersUtils.js @@ -219,7 +219,7 @@ export const deepChange = (nodes, findValue, propName, propValue) => { }; export const updateAvailableTileMatrixSetsOptions = ({ tileMatrixSet, matrixIds, ...layer }) => { - if (!layer.availableTileMatrixSets && tileMatrixSet && matrixIds) { + if ( tileMatrixSet && matrixIds) { const matrixIdsKeys = isArray(matrixIds) ? matrixIds : Object.keys(matrixIds); const availableTileMatrixSets = matrixIdsKeys .reduce((acc, key) => { @@ -265,7 +265,7 @@ export const extractTileMatrixFromSources = (sources, layer) => { const availableTileMatrixSets = Object.keys(layer.availableTileMatrixSets) .reduce((acc, tileMatrixSetId) => { const tileMatrixSetLink = getTileMatrixSetLink(layer, tileMatrixSetId); - const tileMatrixSet = get({ sources }, tileMatrixSetLink); + const tileMatrixSet = get({ sources }, tileMatrixSetLink) || get({ sources }, tileMatrixSetLink.replace("http:", "https:")); if (tileMatrixSet) { return { ...acc, diff --git a/web/client/utils/WFSLayerUtils.js b/web/client/utils/WFSLayerUtils.js index 2a4b1061d4..c4fcf64a87 100644 --- a/web/client/utils/WFSLayerUtils.js +++ b/web/client/utils/WFSLayerUtils.js @@ -20,7 +20,7 @@ export const needsReload = (oldOptions, newOptions) => { return true; } return found; - }, false); + }, false) || oldOptions.url !== newOptions.url; }; export const toDescribeURL = ({ name, search = {}, url, describeFeatureTypeURL } = {}) => { diff --git a/web/client/utils/WMTSUtils.js b/web/client/utils/WMTSUtils.js index bd1c67e164..032a329d29 100644 --- a/web/client/utils/WMTSUtils.js +++ b/web/client/utils/WMTSUtils.js @@ -40,7 +40,7 @@ export const getTileMatrixSet = (tileMatrixSet, srs, allowedSRS, matrixIds = {}, if (tileMatrixSet) { return getEquivalentSRS(srs, allowedSRS).reduce((previous, current) => { if (isArray(tileMatrixSet)) { - const matching = head(tileMatrixSet.filter((matrix) => ((matrix["ows:Identifier"] === current || getEPSGCode(matrix["ows:SupportedCRS"]) === current) && matrixIds[matrix["ows:Identifier"]]))); + const matching = head(tileMatrixSet.filter((matrix) => ((matrix && (matrix["ows:Identifier"] === current || getEPSGCode(matrix["ows:SupportedCRS"]) === current) && matrixIds[matrix["ows:Identifier"]])))); return matching && matching["ows:Identifier"] ? matching["ows:Identifier"] : previous; } else if (isObject(tileMatrixSet)) { return tileMatrixSet[current] || previous; @@ -175,11 +175,11 @@ export const getTileMatrix = (_options, srs) => { const tileMatrixSetName = getTileMatrixSet(options.tileMatrixSet, srs, options.allowedSRS, options.matrixIds); const ids = options.matrixIds && getMatrixIds(options.matrixIds, tileMatrixSetName || srs); const tileMatrixSet = sortTileMatrix( - head(options.tileMatrixSet.filter(tM => tM['ows:Identifier'] === tileMatrixSetName)), + head(options.tileMatrixSet.filter(tM => tM && tM['ows:Identifier'] === tileMatrixSetName)), ids); // identifiers are in the same order of scales and resolutions - const identifiers = tileMatrixSet?.TileMatrix.map?.(t => t["ows:Identifier"]); + const identifiers = tileMatrixSet?.TileMatrix.map?.(t => t && t["ows:Identifier"]); // use same order of matrixIds in TileMatrix, if present. const matrixIds = identifiers && ids ? ids.sort((a, b) => {