QGIS – How to Merge Overlapping Rasters Ignoring No Data Values

gdalmergenodataqgisraster

I thought this would be extremely basic task but obviously it's not. In QGIS3 GDAL Merge (GUI), I am trying to merge two rasters which overlap and each of them has a different distribution of nodata values. I want the rasters to be mosaiced together such that nodata values are ignored if one the rasters does not have nodata value on that spot. In ArcGIS it is that simple, why not QGIS?

Best Answer

Probably best performed using the command line. Yes there is the gdal_merge script, but an alternative approach is to use gdalbuildvrt with the component rasters and use gdaltranslate to create the final raster. See the answers to this question:

Merge thousands of rasters with gdal_merge.py

For my application, I had a lot of no-data values and did not have any problems. I had to use custom merge scripting though. So I created a python script which updated the VRT and applied the required Python functions.