Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 committed Nov 8, 2024
1 parent 5e68376 commit 95bad6b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions web/client/utils/LayersUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const deepChange = (nodes, findValue, propName, propValue) => {
};

export const updateAvailableTileMatrixSetsOptions = ({ tileMatrixSet, matrixIds, ...layer }) => {
if ( tileMatrixSet && matrixIds) {
if (!layer.availableTileMatrixSets && tileMatrixSet && matrixIds) {
const matrixIdsKeys = isArray(matrixIds) ? matrixIds : Object.keys(matrixIds);
const availableTileMatrixSets = matrixIdsKeys
.reduce((acc, key) => {
Expand Down Expand Up @@ -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) || get({ sources }, tileMatrixSetLink.replace("http:", "https:"));
const tileMatrixSet = get({ sources }, tileMatrixSetLink);
if (tileMatrixSet) {
return {
...acc,
Expand Down
6 changes: 3 additions & 3 deletions web/client/utils/WMTSUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 && (matrix["ows:Identifier"] === current || getEPSGCode(matrix["ows:SupportedCRS"]) === current) && matrixIds[matrix["ows:Identifier"]]))));
const matching = head(tileMatrixSet.filter((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;
Expand Down Expand Up @@ -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 && tM['ows:Identifier'] === tileMatrixSetName)),
head(options.tileMatrixSet.filter(tM => tM['ows:Identifier'] === tileMatrixSetName)),
ids);
// identifiers are in the same order of scales and resolutions

const identifiers = tileMatrixSet?.TileMatrix.map?.(t => t && t["ows:Identifier"]);
const identifiers = tileMatrixSet?.TileMatrix.map?.(t => t["ows:Identifier"]);
// use same order of matrixIds in TileMatrix, if present.
const matrixIds = identifiers && ids
? ids.sort((a, b) => {
Expand Down

0 comments on commit 95bad6b

Please sign in to comment.