我已经使用带有 ol.source.WMTS 的 Openlayers 加载了多波段 geotiff,
我想用一些乐队的价值来呈现定制风格。
我知道我可以使用 geotiff.js 和 canvas 来实现,但是当 tif tiles 超过 500KB 时速度太慢并且浏览器崩溃。我想在 Openlayers 中使用 WebGLTile 或其他。我这样尝试:
const wmtsSource = new WMTS({
url: 'https://www.test.com/service/wmts?',
layer: 'test:res_4',
format: 'application/bandstiff',
matrixSet: 'EPSG:3857',
attributions: [
],
tileGrid: tileGrid,
dimensions: {
'threshold': 100,
},
});
const max = 3000;
function normalize(value) {
return ['/', value, max];
}
const red = normalize(['band', 1]);
const green = normalize(['band', 2]);
const blue = normalize(['band', 3]);
const nir = normalize(['band', 4]);
const trueColor = {
color: ['array', red, green, blue, 1],
gamma: 1.1,
};
const map = new Map({
target: 'map',
view: new View({
projection: projection,
center: [13092106, 3693413],
zoom: 10,
}),
layers: [
new TileLayer({
visible: true,
opacity: 0.8,
style : trueColor,
source: wmtsSource,
}),
]
});
但是我不能设置他们的样式。渲染结果是空白。 谁知道我怎么能意识到这一点?
你能给我一些线索吗,非常感谢。