Return null if the layer was not found in the WMTS capabilities
This commit is contained in:
@@ -292,7 +292,7 @@ ol.source.WMTS.prototype.updateDimensions = function(dimensions) {
|
||||
* - style - {string} The name of the style
|
||||
* - format - {string} Image format for the layer. Default is the first
|
||||
* format returned in the GetCapabilities response.
|
||||
* @return {olx.source.WMTSOptions} WMTS source options object.
|
||||
* @return {?olx.source.WMTSOptions} WMTS source options object or `null` if the layer was not found.
|
||||
* @api
|
||||
*/
|
||||
ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
@@ -300,6 +300,9 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
|
||||
var l = ol.array.find(layers, function(elt, index, array) {
|
||||
return elt['Identifier'] == config['layer'];
|
||||
});
|
||||
if (l === null) {
|
||||
return null;
|
||||
}
|
||||
var tileMatrixSets = wmtsCap['Contents']['TileMatrixSet'];
|
||||
var idx, matrixSet, matrixLimits;
|
||||
if (l['TileMatrixSetLink'].length > 1) {
|
||||
|
||||
Reference in New Issue
Block a user