Tutorial moved to http://www.qgistutorials.com/en/docs/raster_mosaicing_and_clipping.html
QGIS has basic raster functionality via the GdalTools plugin. This plugin is on by default and available via with ‘Raster’ menu. If you do not see the options under Raster menu, please follow this tutorial to find and enable the plugin. In this tutorial, I will explain some basics of rasters captured by satellite sensors and show you how to mosaic and subset imagery within Quantum GIS.
The data we will be using is from NASA public domain NASA/GSFC, Rapid Response imagery. This satellite imagery is from the Moderate-resolution Imaging Spectroradiometer (MODIS) sensor onboard the Terra satellite. I downloaded several FAS 2km subset geotiffs in southern Africa and saved in on my hard drive.
Load these images in QGIS. Click on Layers → Add Raster Layer. Browse to the directory with the individual images. Hold down the ‘SHIFT’ key and click on the image files to make a multiple selection. Click ‘Open’. You will see the images load up in the Table of Content on the left panel. You will see there are 5 individual satellite images. Right click on any one of the images and click Properties. In the Properties dialog, you can examine the details about the image in the General and Metadata tabs. Each raster can be displayed using upto 3 bands - one for each of Red, Green and Blue (RGB) channels. This particular image is a 3-6-7 band combination of the MODIS sensor. This means that the Band 3 is displayed in Red channel, Band 6 is displayed in Green channel and Band 7 is displayed in Blue channel. Since the bands 3-6-7 do not represent the real R G and B sensors, this image is called a False Color Composite (FCC). There is also a True Color version of these images available to download as well. Click OK and return to the main QGIS window. Now let us create a single ‘Mosaic’ image from all these individual images. Click on Raster → Miscellaneous → Merge. This menu option uses a GDAL utility in the backend called ‘gdal_merge’. Click Select next to Input files and browse to the directory containing all the individual geotiffs. Keep holding ‘SHIFT’ key and select all of them. Click OK. Next, click ‘Select’ next to Output file and name the output file as ‘mosaic.tif’. At the bottom, check the box next to ‘Load into canvas when finished’. Click OK. You will get a pop-up message saying ‘Processing complete’, once the mosaic is created and loaded to the Canvas. Click ‘Close’. You will see that the individual images and now combined and mosaiced into a single mosaic.tif Another Raster operation you can do is to subset or ‘crop’ an image. Let us create a subset of this mosaic. Click on Raster → Extraction → Clipper. In the Clipper dialog, choose the ‘mosaic’ as the input file from the dropdown box. In the Output file, click Select and name the output file as ‘subset.tif’. Now we have to choose the exxtent of our subset by draing a selection in the canvas window. Switch to the Canvas window and draw a rectangle selection in the image. Now switch back to the Clipper dialog and you will see that the coordinate fields are populated based on your selection. If you need to subset using have specific bounding box, you can also manually enter the coordinates here. At the bottom, check the box next to ‘Load into canvas when finished’. Click OK. Once the processing is complete, you will see a new layer named ‘subset’ loaded in the canvas. This is your subset image created in the last step. Pro Tip: The Clipper process uses gdal_translate utility at the backend to carry out the subsetting task. If you look at the documentation of gdal_translate, there are lots of advanced options. If you wish to use any of these option in the above task, you can click ‘Edit’ button at the bottom of the Clipper window and enter the desired option by typing in. This will be useful if you want to have access to some advanced gdal_translate functionality.