null pointer fix and improved handling of Identifier

Fix nullpointer error when a matrixSet is not found in the matrixsetobj when matrix limits exist.
Also check for match by prepending matrixSetObj.Identifier which is supported by some wmts services.
This commit is contained in:
sweco-dkjesh
2020-09-09 12:29:43 +02:00
parent 3d5f375d52
commit 132ce172ed

View File

@@ -465,10 +465,12 @@ export function optionsFromCapabilities(wmtsCap, config) {
//in case of matrix limits, use matrix limits to calculate extent
if (matrixLimits) {
selectedMatrixLimit = matrixLimits[matrixLimits.length - 1];
matrix = find(
const m = find(
matrixSetObj.TileMatrix,
(value) => value.Identifier === selectedMatrixLimit.TileMatrix
(tileMatrixValue) => tileMatrixValue.Identifier === selectedMatrixLimit.TileMatrix || matrixSetObj.Identifier + ":" + tileMatrixValue.Identifier === selectedMatrixLimit.TileMatrix
);
if (m)
matrix = m;
}
const resolution =