Working with Trieste raster data with QGIS
We already worked with some raster data in QGIS. We already georreferenced images and use them to create new features.
In this exercise, we will use some digital terrain models (DTM) to process raster data in QGIS.
For a brief introduction to these type of geographic information, you can follow the Ordenance Survey Raster and Vector data summary.
- 1 Download the DTM
- 2 Other source of DTM
- 3 Uncompress the tile
- 4 Reproject the DTM
- 5 Sampling our raster data
- 6 Styling
- 7 DEM analysis
- 8 Profile plugin
- 9 Export the DEM
Download the DTM
Note: a copy of the downloaded tile is available from here. Use this copy for the exercices. Later you can explore NASA Earthdata Search website.
The ASTER GDEM data can be downloaded from the NASA Earthdata Search website. You need an account to download the data.
Draw a rectangle around Trieste and use ASTER as the search term. From the results, use the right button on the result to show the granules on the map.
Identify the granule (tile) to download. Then click on the download button to proceed.
Other source of DTM
Uncompress the tile
The data comes in a h5 file format, that QGIS can read.
Add the raster AG100.v003.46.013.0001.h5 to QGIS. Slect only the first layer ASTER_GDEM/ASTGDEM.
Reproject the DTM
We added two layer to QGIS. Each has a different coordinate system, and QGIS dynamically reprojects all layers to the map canvas coordinate system. In this case, since we add wuham.shp layer first, the map canvas is using the EPSG:4497 coordinate system, and the raster is reprojected on the fly.
Let's start by reprojecting the raster to the same EPSG:4497.
Fill the reproject dialog with the following data:
You can remove the former ASTGTM2_N30E114_dem layer from the project.
Sampling our raster data
The original ASTGTM2_N30E114_dem.tif is an image with 3601x3601 pixels (our dem.tiff was rotated, and it became a 3451 by 3951 image). Each pixel has a value: its value is the mean height of that location.
The default style is based on a Singleband gray (as Render type), the gray does from Black to white (on Color gradient) and the values ranges from -0.474 to 118.996 meters. These estimated values, by doing a fast analysis if the raster. Remember that this image has 3601 x 3601 = 12967201, which are almost 13 million pixels.
To really know the pixel value range, we can:
- select Min/max
- select Actual (slower)
- Load button
New values are computed. You can compare the values before and after this sampling process.
As you can see, in this case we have values below 0 (we will find out where) and also values far more higher then the initial 118 estimation.
To style this raster more appropriately, we need:
- Change the render type to Singleband pseudocolor
- Toogle Invert (after the Spectral color map); blues for lower altitudes are reds for higher
- We switch the Mode from Continuous to Equal interval
- 6 classes, instead of 5
- We set the Min elevation to 0 and the Max to 750
- We use the Classify button to generate our 6 classes
With this new style (and removing the polygon fill from the vector layer) we get a new map like:
Values below 0 are not distinguished
Only a smaller are has higher values
After these two adjustments, the map looks like:
Our raster dataset only has the elevation value for each pair of coordinates. We will use this precious information to compute:
All are available from the DEM (Terrain models) menu entry.
Fill the Output file with hillshade.tiff. Keep the default options.
Hillshade over pseudocolor:
In the following map, we use:
- hillshade, with 60% transparency
- pseudocolor band below
Fill the Output file with slope.tiff. Keep the default options.
You can use transparency to enhance the visual feedback.
In the following map, we use:
- slope, with 80% transparency
- hillshade, with 50% transparency
Fill the Output file with aspect.tiff. Keep the default options.
Export the DEM
Install Qgis2threejs plugin in QGIS.
Repreoject the layers to EPSG:3045.
Export the project: Web → Qgis2threejs → Qgis2threejs
The result on the browser: