Frequently, raster data is made available in tiles. In fact, some consider the Murphy's Law of GIS to be that your study area lies at the intersection of four topographic quadrangles. In this situation, the input rasters will need to be combined into a seamless raster that covers the study area. When doing this, the individual input rasters must all be in the same coordinate reference system and have the same number of bands.
Assuming that these two conditions have been met, the Merge tool that can be found by navigating to Raster | Miscellaneous can be used to merge the individual rasters together. This tool is a GUI version of the GDAL_merge
command-line tool. Overlap among the input rasters is allowed. If this happens, the data for the last image in the list will be used for the area of overlap. In the Merge dialog, you have the option to choose whether you wish to merge all the rasters in a folder, or you can pick individual rasters to merge. This provides a nice built-in batch-processing option. The following are the options for running the Merge tool:
35106-G4.tif
, 35106-G5.tif
, 35106-H4.tif
, and 35106-H5.tif
are being merged. (Note that this data has a CRS of EPSG: 26913, so the project CRS should be set to this.)Notice that the syntax equivalent to the gdal_merge
command line is displayed as you choose your merge options. If you are familiar with the GDAL command-line syntax, you can use the edit button ()
to set the tool options by editing the command directly. For example, you could specify the output image format as a 16-bit integer by using the –ot Int16
parameter. You could also specify the output pixel size with the –ps
parameter. The GDAL help page for this command can be found at http://www.gdal.org/gdal_merge.html.
The Creation Options allow you to add your own command-line options and set parameters, such as the compression profile to be used on the output image.
The following screenshot shows the Merge
command that is configured to mosaic the collection of input rasters. The equivalent command-line syntax is displayed in the window:
There are two additional tools in QGIS that can be used to create raster mosaics.
Both of these require the rasters to be merged and loaded into the QGIS map canvas. The first is the GRASS tool r.patch. It can be found by navigating to Processing Toolbox | Grass Commands | Raster | r.patch.
The second tool is the SAGA tool Mosaic raster layers. This tool can be found by navigating to Processing Toolbox | SAGA | Raster tools | Mosaic raster layers. This SAGA tool lets you determine how overlapping cells in the set of input rasters will be handled. You can choose to use the first value in the order of the grid list or the mean value. It also allows you to choose the interpolation method. See the following screenshot: