Do not require projection extent for WMTS bbox validity check
This commit is contained in:
@@ -355,7 +355,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
|
||||
goog.asserts.assert(l['TileMatrixSetLink'].length > 0,
|
||||
'layer has TileMatrixSetLink');
|
||||
var idx, matrixSet, wrapX;
|
||||
var idx, matrixSet;
|
||||
if (l['TileMatrixSetLink'].length > 1) {
|
||||
idx = goog.array.findIndex(l['TileMatrixSetLink'],
|
||||
function(elt, index, array) {
|
||||
@@ -380,13 +380,6 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
goog.asserts.assert(!goog.isNull(matrixSet),
|
||||
'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]);
|
||||
if (goog.isDef(config['format'])) {
|
||||
format = config['format'];
|
||||
@@ -434,16 +427,24 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
/urn:ogc:def:crs:(\w+):(.*:)?(\w+)$/, '$1:$3'));
|
||||
}
|
||||
|
||||
var projectionExtent = projection.getExtent();
|
||||
var extent;
|
||||
if (!goog.isNull(projectionExtent)) {
|
||||
var projectionExtentWgs84 = ol.proj.transformExtent(
|
||||
projectionExtent, projection, 'EPSG:4326');
|
||||
if (ol.extent.containsExtent(projectionExtentWgs84, wgs84BoundingBox)) {
|
||||
extent = ol.proj.transformExtent(
|
||||
wgs84BoundingBox, 'EPSG:4326', projection);
|
||||
var wgs84BoundingBox = l['WGS84BoundingBox'];
|
||||
var extent, wrapX;
|
||||
if (goog.isDef(wgs84BoundingBox)) {
|
||||
var wgs84ProjectionExtent = ol.proj.get('EPSG:4326').getExtent();
|
||||
wrapX = (wgs84BoundingBox[0] == wgs84ProjectionExtent[0] &&
|
||||
wgs84BoundingBox[2] == wgs84ProjectionExtent[2]);
|
||||
extent = ol.proj.transformExtent(
|
||||
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(
|
||||
matrixSetObj, extent);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user