This commit is contained in:
Amir Ashkan Baghdoust
2021-03-07 18:31:04 +01:00
481 changed files with 22380 additions and 6525 deletions

View File

@@ -370,10 +370,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
return el['Identifier'] == elt['TileMatrixSet'];
});
const supportedCRS = tileMatrixSet['SupportedCRS'];
const proj1 =
getProjection(
supportedCRS.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(supportedCRS);
const proj1 = getProjection(supportedCRS);
const proj2 = getProjection(config['projection']);
if (proj1 && proj2) {
return equivalent(proj1, proj2);
@@ -435,10 +432,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
let projection;
const code = matrixSetObj['SupportedCRS'];
if (code) {
projection =
getProjection(
code.replace(/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3')
) || getProjection(code);
projection = getProjection(code);
}
if ('projection' in config) {
const projConfig = getProjection(config['projection']);
@@ -458,7 +452,7 @@ export function optionsFromCapabilities(wmtsCap, config) {
let selectedMatrixLimit = {
MinTileCol: 0,
MinTileRow: 0,
// substract one to end up at tile top left
// subtract one to end up at tile top left
MaxTileCol: matrix.MatrixWidth - 1,
MaxTileRow: matrix.MatrixHeight - 1,
};
@@ -466,10 +460,16 @@ 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 =