I am trying to prepare a hillshade layer for MapServer based on GDAL DEM functions, as described in https://medium.com/@david.moraisferreira/shaded-relief-maps-using-gdal-a-beginners-guide-6a3fe56c6d. Everything goes correctly but I would like to modify the output results so WMS/WMTS would be more transparent like in the bottom picture.
If you guys can give me any suggestion would be great.
Current output:
Desirable output:
The answer can be found here: https://gis.stackexchange.com/questions/144535/creating-transparent-hillshade
In order to reveieve partly transparent image you have to mix gray band (hillshade) and opacity band (that need to be prepared)
So first step is to prepare hillshade:
gdaldem hillshade input.tif hillshade.tmp.tif -s 111120 -z 5 -az 315 -alt 60 -compute_edges
then prepare the opacity band
# hillshade px=A, opacity is its invert: px=255-A
gdal_calc.py -A ./hillshade.tmp.tif --outfile=./opacity.tif --calc="255-A"
then build final hillshade
# assigns to relevant bands -b 1 and -b 2
gdalbuildvrt -separate ./final.vrt ./hillshade.tmp.tif ./opacity.tif