【发布时间】:2021-12-24 18:21:47
【问题描述】:
我使用 fetch WMTSCapabilities 但我收到以下消息: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'Layer') 在 Function.rL.source.WMTS.optionsFromCapabilities (ol.js:2)
这是我使用的代码:
const parser = new ol.format.WMTSCapabilities();
let bgRaster;
fetch('data/WMTSCapabilities.xml')
.then(function (response) {
return response.text();
})
.then(function (text) {
const result = parser.read(text);
const options = ol.source.WMTS.optionsFromCapabilities(result, {
layer: 'standaard',
format: 'image/png',
matrixSet: 'EPSG:28992',
});
bgRaster = new ol.layer.Tile({
opacity: 0.7,
source: new ol.source.WMTS(options),
title: 'Kadaster',
visible: false
});
})
【问题讨论】:
标签: javascript fetch openlayers-6