Mozaicarea și Tăierea Rasterelor (QGIS3)

This tutorial explores basic techniques for working with rasters in QGIS such as mosaicing and subsetting.

Privire de ansamblu asupra activității

We will download elevation data for Sri Lanka in form of SRTM tiles, merge them and clip the resulting mosaic to the country boundary.

Alte competențe pe care le veți dobândi

  • Using the Hillshade renderer to visualize elevation data.

Obținerea datelor

Land Processes Distributed Active Archive Center (LP DAAC) provides NASA Shuttle Radar Topography Mission (SRTM) Global 1 arc second dataset as elevation tiles.

An easy interface to download tiles for a given area is the 30-Meter SRTM Tile Downloader by By Derek Watkins. Download the individual SRTM tiles covering Sri Lanka. Note that you will need a free Earth Data account to download the data.


We will also need the Admin 0 - Countries shapefile from Natural Earth.

Pentru comoditate, puteți descărca o copie a seturilor de date direct de la adresele de mai jos:

Sursa de date [SRTM] , [NATURALEARTH]


  1. Open QGIS and locate the downloaded files in the Browser panel. Expand individual zip files to show the .hgt files. Hold the Ctrl key and select all individual files. Once selected, drag them to the canvas.

  1. You will see 11 individual layers loaded in the Layers panel and displayed in the canvas. We will merge these individual tiles into a single mosaic. Go to Processing ‣ Toolbox.

  1. Search and locate the GDAL ‣ Raster miscellaneous ‣ Merge tool. Double-click to launch it.

  1. In the Merge dialog, click the button next to Input layers. Click Select All to select all individual layers.

  1. As mentioned in the dataset layer details, the input data type is 16-bit signed integer. To maintain data integrity, we should keep the same data type for the merged layer. Select Int16 as the Output data type. Also the default output data format is GeoTiff. GeoTiff files can get very large if not compressed. Choose High Compression as the Profile. Click Run.

  1. Once the processing finishes, the a new layer OUTPUT will be added to the Layers panel. In case the layer is not at the top of the stack, select it and drag it to the top of the Layers panel.

  1. You will see that the OUTPUT layer contains the merged elevation data from the individual input tiles. The default visualization only shows the pixel values in the range from 0-255. But our data contains pixels with values -14 to 2371, resulting in a low contrast rendering. Let’s change it a better visualization. Click the Open the layer Styling panel button in the Layers panel.

  1. In the Layer Styling panel, click the Render type dropdown and select Hillshade renderer. This rendering option is particularly well-suited for elevation data.

  1. Another common operation when working with rasters is to clip a raster to your area of interest. For this tutorial, we will clip the merged layer to the country boundary for Sri Lanka. Locate the downloaded file and expand it. Drag the ne_10m_admin_0_countries.shp file to the canvas.

  1. Select the newly added ne_10m_admin_0_countries layers in the Layers panel. Click the Select Features by area or single click button on the Attributes Toolbar. Once selected, click the polygon for Sri Lanka to select it.

  1. Keep the selection as it is and open Processing ‣ Toolbox. Search and locate the GDAL ‣ Raster extraction ‣ Clip raster by mask layer tool. Double-click to launch it.

  1. In the Clip Raster by Mask Layer dialog, set OUTPUT as the Input Layer. Select ne_10m_admin_0_countries as the Mask layer, and check the Selected features only checkbox. Enter 0.0000 as the Assign a specified nodata value to output bands. As before, choose High compression as the Profile. Click Run.

  1. A new layer OUTPUT will be added to the Layers panel. At this point, it may be hard to see the output because we have too many overlapping layers visible. Click the Manage Map Themes button in the Layers panel and choose Hide All Layers.

  1. Turn on only the latest OUTPUT layer and style it with the Hilshade renderer as done before.

  1. The merged and subsetted output elevation layer for Sri Lanka is ready.

comments powered by Disqus