GeoTIFF Transparency
I have spent way too much time messing with this, and certainly too many CPU cycles processing only to get the wrong output. The problem…
“Two irregular shaped geotiffs that you need to merge into one and not have any stupid gaps”
My first attempts resulted in things like…
Not the desired output, but the fix was easy really, first fix the nodata value with
gdal_translate -a_nodata 0 \ -of GTiff \ file1.tif \ file1_nodata0.tif
gdal_translate -a_nodata 0 \ -of GTiff \ file2.tif \ file2_nodata0.tif
Then merge the two
gdal_merge.py -n 0 \ -a_nodata 0 \ file1_nodata0.tif file2_nodata0.tif \ -o merged_file
That results in a nicely merged GeoTIFF