Return null if the layer was not found in the WMTS capabilities

This commit is contained in:
Frederic Junod
2017-03-08 15:03:48 +01:00
parent cc13ca68fa
commit 2e22fce718
5 changed files with 23 additions and 8 deletions

View File

@@ -99,13 +99,15 @@ fetch(url).then(function(response) {
return response.text();
}).then(function(text) {
var result = parser.read(text);
var options = ol.source.WMTS.optionsFromCapabilities(result,
{layer: 'OSM_Land_Mask', matrixSet: 'EPSG3413_250m'});
var options = ol.source.WMTS.optionsFromCapabilities(result, {
layer: 'OSM_Land_Mask',
matrixSet: 'EPSG3413_250m'
});
options.crossOrigin = '';
options.projection = 'EPSG:3413';
options.wrapX = false;
layers['wmts3413'] = new ol.layer.Tile({
source: new ol.source.WMTS(options)
source: new ol.source.WMTS(/** @type {!olx.source.WMTSOptions} */ (options))
});
});