Based on the sea height eample from ol3 and mapbox global terrain we made a similar setup putting elevation values into tiles and setting up with ol.source.raster
var elevation = new ol.source.TileImage({
url: penetrationUrls[this.designator.toLowerCase()],
projection: newProj,// "EPSG:27700",
crossOrigin: 'anonymous',
tileGrid: tilegrid
});
var raster = new ol.source.Raster({
sources: [elevation],
operation: penetrates
});
now -
1) is there any smart way to when having mouse over to query the pixel value to show tooltip for the elevation? 2) is there a smart way to reuse already loaded tiles if wanting toquery the heights following a linestring or something?
We do not render the layer and the following code was what I ended up using. Skipped the raster layers that was manipulating the elevation source.
If improving on this, i would add a LRU cache on the tile cache, maybe its possible to hook into ols tile cache.
If you also render the contents from the raster source as layer, there is an easier way to get pixel data - using
Map#forEachLayerAtPixel
. Something like this: