2

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?

2 Answers 2

3

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.

1
  • Thanks a lot and yes, I saw this coming. Thought there would be a GUI solution since this belongs to a basic map algebra and needs just sort of an "override no data with valid data" option.
    – janchytry
    Commented Feb 27, 2020 at 15:49
2

https://gis.stackexchange.com/a/306293/22646 suggests to go via a virtual raster (gdalbuildvrt or gdal_merge.py -of VRT).

If you would like to go down this path in QGIS, you could try the GDAL Build Virtual Raster algorithm (found in the Processing Toolbox). You can choose as many Input (raster) layers as you like (the ... button). For Resolution (in overlapping areas) you can choose between Average, Highest and Lowest.

The resulting virtual raster can (for instance) be saved as GeoTiff (Layer-> Save As...).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.