forked from openlayers/openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
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 openlayers#16067 from mike-000/cog-setstyle
Reset layer style when new GeoTIFF source is ready
- Loading branch information
Showing
3 changed files
with
50 additions
and
2 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
Loading
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,37 @@ | ||
import GeoTIFF from '../../../../src/ol/source/GeoTIFF.js'; | ||
import Map from '../../../../src/ol/Map.js'; | ||
import TileLayer from '../../../../src/ol/layer/WebGLTile.js'; | ||
import View from '../../../../src/ol/View.js'; | ||
|
||
const layer = new TileLayer({ | ||
style: { | ||
color: ['array', ['band', 1], ['band', 1], ['band', 1], ['band', 2]], | ||
}, | ||
}); | ||
|
||
const map = new Map({ | ||
target: 'map', | ||
layers: [layer], | ||
view: new View({ | ||
center: [0, 0], | ||
zoom: 0, | ||
}), | ||
}); | ||
|
||
fetch('/data/raster/sentinel-b08.tif') | ||
.then((response) => response.blob()) | ||
.then((blob) => { | ||
const source = new GeoTIFF({ | ||
sources: [{blob: blob}], | ||
transition: 0, | ||
}); | ||
|
||
layer.setSource(source); | ||
source.getView().then((options) => { | ||
map.setView(new View(options)); | ||
}); | ||
|
||
render({ | ||
message: 'alpha styled from band 2', | ||
}); | ||
}); |