-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15787 from tschaub/palette
Delete palette texture before creating a new context
- Loading branch information
Showing
4 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import GeoTIFF from '../../../../src/ol/source/GeoTIFF.js'; | ||
import Map from '../../../../src/ol/Map.js'; | ||
import TileLayer from '../../../../src/ol/layer/WebGLTile.js'; | ||
|
||
const source = new GeoTIFF({ | ||
sources: [ | ||
{ | ||
url: '/data/raster/sentinel-b04.tif', | ||
min: 0, | ||
max: 10000, | ||
}, | ||
{ | ||
url: '/data/raster/sentinel-b08.tif', | ||
min: 0, | ||
max: 10000, | ||
}, | ||
], | ||
transition: 100, | ||
}); | ||
|
||
const nir = ['band', 2]; | ||
const red = ['band', 1]; | ||
const ndvi = ['/', ['-', nir, red], ['+', nir, red]]; | ||
|
||
const layer = new TileLayer({ | ||
source: source, | ||
style: { | ||
color: [ | ||
'palette', | ||
['interpolate', ['linear'], ndvi, -0.2, 0, 0.65, 4], | ||
['#440154', '#3b528b', '#21918c', '#5ec962', '#fde725'], | ||
], | ||
}, | ||
}); | ||
|
||
const map = new Map({ | ||
layers: [layer], | ||
target: 'map', | ||
view: source.getView(), | ||
}); | ||
|
||
// regression test for https://github.com/openlayers/openlayers/issues/15786 | ||
map.once('rendercomplete', () => { | ||
map.removeLayer(layer); | ||
map.addLayer(layer); | ||
render({ | ||
message: 'palette still works after adding and removing layer', | ||
}); | ||
}); |