Tuesday, 24 April 2018

gdal - Is it possible to create .OVR (like by gdaladdo) as smooth as QGIS oversampling feature of raster layer?


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?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...