[GIS] Combine several rasters in QGIS

mergeqgisraster

I have a problem combining several rasters into one big raster. Particular annoying is, that I had this problem once before and solved it, but I can't remember how. Unfortunately the other StackExchange-Entries didn't help me either.

I try to combine a set of grayscale rasters using the function Raster>Miscellaneous>Merge. The problem is, that the outputraster always contains gaps, where the novalue areas of one raster overlap the value area of another layer. This Problem seems to appear no matter what settings I choose. Sometimes the merge-function creates an multicolor raster and tries to put the different input rasters into different colorbands. In any case I dont get the wanted result. Does anybody know this problem and remember how to get rid of it?

Best Answer

You can use gdal_translate -a_nodata <your_no_data_value> input.tif output.tif to get rid of the no_data values. In QGIS Raster>Conversions>Translate. After that you can build a vrt (Raster>Miscellaneous>Build Virtual Raster; gdalbuildvrt) or you can merge them. With the help of a vrt layer you can save any supported raster file format you want and you can use map extends (right-klick on layer and Save As).

E.g. using a Linux machine you can write a bash script when you have a lot of raster files.

Related Question