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.

../../_images/data120.png

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:

N05E080.SRTMGL1.hgt.zip

N06E079.SRTMGL1.hgt.zip

N06E080.SRTMGL1.hgt.zip

N06E081.SRTMGL1.hgt.zip

N07E079.SRTMGL1.hgt.zip

N07E080.SRTMGL1.hgt.zip

N07E081.SRTMGL1.hgt.zip

N08E079.SRTMGL1.hgt.zip

N08E080.SRTMGL1.hgt.zip

N08E081.SRTMGL1.hgt.zip

N09E080.SRTMGL1.hgt.zip

ne_10m_admin_0_countries.zip

Sursa de date [SRTM] , [NATURALEARTH]

Procedure

  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.

../../_images/1148.png
  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.

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

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

../../_images/435.png
  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.

../../_images/531.png
  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.

../../_images/630.png
  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.

../../_images/730.png
  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.

../../_images/829.png
  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 ne_10m_admin_0_countries.zip file and expand it. Drag the ne_10m_admin_0_countries.shp file to the canvas.

../../_images/930.png
  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.

../../_images/1037.png
  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.

../../_images/1149.png
  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.

../../_images/1239.png
  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.

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

../../_images/1434.png
  1. The merged and subsetted output elevation layer for Sri Lanka is ready.

../../_images/1530.png

If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)