Adjusts the WMTSCapabilities format to read the projected TileMatrixSet's BoundingBox
This commit is contained in:
@@ -9,7 +9,7 @@ import {assign} from '../obj.js';
|
||||
import {containsExtent} from '../extent.js';
|
||||
import {createFromCapabilitiesMatrixSet} from '../tilegrid/WMTS.js';
|
||||
import {createFromTileUrlFunctions, expandUrl} from '../tileurlfunction.js';
|
||||
import {equivalent, get as getProjection, transformExtent} from '../proj.js';
|
||||
import {equivalent, get as getProjection} from '../proj.js';
|
||||
import {find, findIndex, includes} from '../array.js';
|
||||
|
||||
/**
|
||||
@@ -479,27 +479,25 @@ export function optionsFromCapabilities(wmtsCap, config) {
|
||||
: matrix.TopLeftCorner;
|
||||
const tileSpanX = matrix.TileWidth * resolution;
|
||||
const tileSpanY = matrix.TileHeight * resolution;
|
||||
let extent;
|
||||
const wgs84BoundingBox = l['WGS84BoundingBox'];
|
||||
const tileMatrixExtend = [
|
||||
const matrixSetExtent = matrixSetObj['BoundingBox'];
|
||||
let extent = [
|
||||
origin[0] + tileSpanX * selectedMatrixLimit.MinTileCol,
|
||||
// add one to get proper bottom/right coordinate
|
||||
origin[1] - tileSpanY * (1 + selectedMatrixLimit.MaxTileRow),
|
||||
origin[0] + tileSpanX * (1 + selectedMatrixLimit.MaxTileCol),
|
||||
origin[1] - tileSpanY * selectedMatrixLimit.MinTileRow,
|
||||
];
|
||||
if (wgs84BoundingBox !== undefined) {
|
||||
|
||||
if (
|
||||
matrixSetExtent !== undefined &&
|
||||
!containsExtent(matrixSetExtent, extent)
|
||||
) {
|
||||
const wgs84BoundingBox = l['WGS84BoundingBox'];
|
||||
const wgs84ProjectionExtent = getProjection('EPSG:4326').getExtent();
|
||||
extent = matrixSetExtent;
|
||||
wrapX =
|
||||
wgs84BoundingBox[0] === wgs84ProjectionExtent[0] &&
|
||||
wgs84BoundingBox[2] === wgs84ProjectionExtent[2];
|
||||
extent = transformExtent(wgs84BoundingBox, 'EPSG:4326', projection);
|
||||
|
||||
if (!containsExtent(tileMatrixExtend, extent)) {
|
||||
extent = tileMatrixExtend;
|
||||
}
|
||||
} else {
|
||||
extent = tileMatrixExtend;
|
||||
}
|
||||
|
||||
if (projection.getExtent() === null) {
|
||||
|
||||
Reference in New Issue
Block a user