Merge pull request #10434 from mike-000/patch-6
Disable image smoothing for the DEM source in the Sea Level example
This commit is contained in:
@@ -8,6 +8,11 @@ docs: >
|
|||||||
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
|
<a href="https://www.mapbox.com/blog/terrain-rgb/">Mapbox Terrain-RGB tiles</a>
|
||||||
to "flood" areas below the elevation shown on the sea level slider.
|
to "flood" areas below the elevation shown on the sea level slider.
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<code>ol/source/Raster</code> can take either a tile source or layer.
|
||||||
|
In this case a layer is used to allow disabling at the <code>prerender</code> event
|
||||||
|
of image smoothing which would change the precise elevation values set in the pixels.
|
||||||
|
</p>
|
||||||
tags: "raster, pixel operation, flood"
|
tags: "raster, pixel operation, flood"
|
||||||
cloak:
|
cloak:
|
||||||
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
- key: pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg
|
||||||
|
|||||||
@@ -22,9 +22,15 @@ function flood(pixels, data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
const key = 'pk.eyJ1IjoidHNjaGF1YiIsImEiOiJjaW5zYW5lNHkxMTNmdWttM3JyOHZtMmNtIn0.CDIBD8H-G2Gf-cPkIuWtRg';
|
||||||
const elevation = new XYZ({
|
const elevation = new TileLayer({
|
||||||
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
|
source: new XYZ({
|
||||||
crossOrigin: 'anonymous'
|
url: 'https://api.mapbox.com/v4/mapbox.terrain-rgb/{z}/{x}/{y}.pngraw?access_token=' + key,
|
||||||
|
crossOrigin: 'anonymous'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
elevation.on('prerender', function(evt) {
|
||||||
|
evt.context.imageSmoothingEnabled = false;
|
||||||
|
evt.context.msImageSmoothingEnabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
const raster = new RasterSource({
|
const raster = new RasterSource({
|
||||||
|
|||||||
Reference in New Issue
Block a user