I am trying to add multiple Openlayer image layers (Using raster source) with different extents to a single Map. If I add a single layer, It is shown but adding multiple does not show either.
- I thought
zindex
is the issue which I tried to change with no use. - I tested removing one after adding it, then the second one shows (one not removed)
Logging the number of layers always shows all 3 layers (2 that I added and 1 base layer i.e. map)
this.raster = new RasterSource({
sources: [this.layer.getSource()],
operation: (pixels, data) => {
let pixel = pixels[0];
pixel[0] = 0;
pixel[1] = 255;
pixel[2] = 0;
return pixel;
}
});
let previewColorLayer = new ImageLayer({
opacity: 0.4,
source: this.raster,
extent: [972.145, 1948.98, 1270.395, 2082.48],
zIndex: 1000
// extent: ex
});
let previewColorLayer2 = new ImageLayer({
opacity: 0.4,
source: this.raster,
extent: [952.145, 1756.98, 1270.395, 1890.48],
zIndex: 2000
// extent: ex
});
this.overviewMap.getOverviewMap().addLayer(previewColorLayer);
this.overviewMap.getOverviewMap().addLayer(previewColorLayer2);