1

I found Hugolpz's tutorial for creating a GeoTIFF that contains grayscale with an alpha band.

Creating transparent hillshade?

# filter the color band, keep greyness of relevant shadows below limit
gdal_calc.py -A ./hillshade.tmp.tif  --outfile=./color_crop.tmp.tif \
    --calc="255*(A>220) +      A*(A<=220)"
# filter the opacity band, keep opacity of relevant shadows below limit
gdal_calc.py -A ./hillshade.tmp.tif  --outfile=./opacity_crop.tmp.tif \
    --calc="  1*(A>220) +(256-A)*(A<=220)"
# gdalbuildvrt -separate ./final.vrt ./color_crop.tmp.tif ./opacity_crop.tmp.tif
# gdal_translate -co COMPRESS=LZW -co ALPHA=YES ./final.vrt ./final_crop.tif

I wonder if it's posible to have also the .OVR that contains each zoom level's alpha band? I have tried this

gdaladdo -r bilinear -ro -b 1,2 --config COMPRESS_OVERVIEW DEFLATE --config PREDICTOR_OVERVIEW 2 --config ZLEVEL 9 GrayWithAlpha.tif 2 4 8 16 32 64

I found out that if the command lacks of -b 1,2, it doesn't work at all. Then the result still doesn't match the smoothness of QGIS raster layer oversampling feature. Despite beauty of oversampling, it's very very slow.

So I wonder if I can create .OVR that is as smooth as what presented by QGIS oversampling feature?

  • Have a try with gdaladdo and tell if it works without issues or not. – user30184 Aug 25 '18 at 17:07
  • @user30184 I tried but it seems not very smooth. I'd like to have smoothness that QGIS layer setting "oversampling" offers. – sandthorn Aug 25 '18 at 18:54
  • Can you show screenshots for demonstrating the issue? – user30184 Aug 25 '18 at 19:43
  • @Luke Also changed the subject to express more into the subject. – sandthorn Aug 26 '18 at 9:01
  • have you tried -r cubic or -r cubicspline instead of -r linear ? It should have smoother outputs. But maybe you should do a resampling at a finer resolution (gdalwarp) if you expect something smooth when you zoom in – radouxju Sep 5 '18 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.