4. Mosaic DEM Tiles

Before we proceed, we have to merge the four DEM tiles, which in GIS terminology is called mosaic. Here are two ways to mosaic the tiles:

  • Merge the tiles into one physical raster file (e.g. GeoTIFF)
  • Merge the tiles into a virtual file (.vrt)
The first option is slower. If we have many tiles, we prefer to create a file that virtually merges all the tiles. That will be done with the following steps:

1. In the main menu choose Raster | Miscellaneous | Build Virtual Raster.
build virtual raster

2. In the Build Virtual Raster dialogue you can choose each file individually or merge all files in a directory. We can also merge the files that are visible in the Map Canvas. We'll use the last option:

  • At Input layers click Browse button.

  • Use the Select all button to select the four tiles and click OK (figure
multiple selection dialog

  • Browse to the location where you want to save the output file and give it the name dem_mosaic.vrt.
  • By default, Resolution is set to average. In our case the files all have the same resolution (1 Arc  Second).
  • Uncheck the box before Place each input file into a separate band. This needs to be checked only if you want to create a mapstack, i.e. with remote sensing bands.
  • Keep the Resampling algorithm at the default: nearest. This also has no impact, because resampling is not needed.
The dialogue should now look like the figure below.

build virtual raster dialog

3. Click Run to run the algorithm. Click Close to get back to the main screen where you can see the merged DEM.

You'll notice that in the Map Canvas, the borders of the tiles are not visible anymore in the merged DEM because QGIS stretches the greyscale using the minimum and maximum of the entire merged DEM. This is only for visualisation, the values in the tiles are the same as in the mosaic.

4. Now remove the individual tiles (not the dem_mosaic) from the layers list by selecting them while the Ctrl button is pressed. Then right-click one of the tile names and select Remove Layer. Click OK to confirm. This will remove the tiles from the screen, but not from the hard disk.

remove layers