根据官网上的例子运行GeoTIFF层相关代码时,浏览器显示undefined,代码和报错如下
const layer = new ol.layer.WebGLTile({
style: trueColor,
source: new ol.source.GeoTIFF({
normalize: false,
sources: [
{
url: 'https://s2downloads.eox.at/demo/EOxCloudless/2020/rgbnir/s2cloudless2020-16bits_sinlge-file_z0-4.tif',
},
],
}),
});
搜索了半天不知道错在哪里,最后去openlayers官网搜索GeoTIIFF,发现使用这个需要下载geotiff.js包,如果不想下载需要引入
<script src="https://cdn.jsdelivr.net/npm/geotiff"></script>