Do not require projection extent for WMTS bbox validity check
This commit is contained in:
+17
-16
@@ -355,7 +355,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
|||||||
|
|
||||||
goog.asserts.assert(l['TileMatrixSetLink'].length > 0,
|
goog.asserts.assert(l['TileMatrixSetLink'].length > 0,
|
||||||
'layer has TileMatrixSetLink');
|
'layer has TileMatrixSetLink');
|
||||||
var idx, matrixSet, wrapX;
|
var idx, matrixSet;
|
||||||
if (l['TileMatrixSetLink'].length > 1) {
|
if (l['TileMatrixSetLink'].length > 1) {
|
||||||
idx = goog.array.findIndex(l['TileMatrixSetLink'],
|
idx = goog.array.findIndex(l['TileMatrixSetLink'],
|
||||||
function(elt, index, array) {
|
function(elt, index, array) {
|
||||||
@@ -380,13 +380,6 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
|||||||
goog.asserts.assert(!goog.isNull(matrixSet),
|
goog.asserts.assert(!goog.isNull(matrixSet),
|
||||||
'TileMatrixSet must not be null');
|
'TileMatrixSet must not be null');
|
||||||
|
|
||||||
var wgs84BoundingBox = l['WGS84BoundingBox'];
|
|
||||||
if (goog.isDef(wgs84BoundingBox)) {
|
|
||||||
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
|
|
||||||
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
|
|
||||||
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var format = /** @type {string} */ (l['Format'][0]);
|
var format = /** @type {string} */ (l['Format'][0]);
|
||||||
if (goog.isDef(config['format'])) {
|
if (goog.isDef(config['format'])) {
|
||||||
format = config['format'];
|
format = config['format'];
|
||||||
@@ -434,16 +427,24 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
|||||||
/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3'));
|
/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var projectionExtent = projection.getExtent();
|
var wgs84BoundingBox = l['WGS84BoundingBox'];
|
||||||
var extent;
|
var extent, wrapX;
|
||||||
if (!goog.isNull(projectionExtent)) {
|
if (goog.isDef(wgs84BoundingBox)) {
|
||||||
var projectionExtentWgs84 = ol.proj.transformExtent(
|
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
|
||||||
projectionExtent, projection, 'EPSG:4326');
|
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
|
||||||
if (ol.extent.containsExtent(projectionExtentWgs84, wgs84BoundingBox)) {
|
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);
|
||||||
extent = ol.proj.transformExtent(
|
extent = ol.proj.transformExtent(
|
||||||
wgs84BoundingBox, 'EPSG:4326', projection);
|
wgs84BoundingBox, 'EPSG:4326', projection);
|
||||||
|
var projectionExtent = projection.getExtent();
|
||||||
|
if (!goog.isNull(projectionExtent)) {
|
||||||
|
// If possible, do a sanity check on the extent - it should never be
|
||||||
|
// bigger than the validity extent of the projection of a matrix set.
|
||||||
|
if (!ol.extent.containsExtent(projectionExtent, extent)) {
|
||||||
|
extent = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
var tileGrid = ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet(
|
||||||
matrixSetObj, extent);
|
matrixSetObj, extent);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user