5. Create a Subset of the DEM

5.1. Styling the DEM

By default, QGIS styles raster layers with the Singleband gray renderer. To help interpret the results, it is good practice to intuitively style your layers.

The DEM is a continuous raster. Continuous rasters represent gradients and can therefore contain real numbers ((also called decimal numbers or floating point). Continuous rasters are styled in QGIS using ramps from the Singleband pseudocolor renderer in the Layer Styling panel.

1. Select the dem_subset layer and click Open layer styling panel button to open the Layer Styling panel (or press F7).

2. In the Layer Styling panel, choose Singleband pseudocolor from the drop-down list.



3. Click the arrow at Color ramp and choose Create New Color Ramp... from the dropdown menu.



4. In the popup Color ramp type dialog choose Catalog: cpt-city from the drop-down list. Click OK.

color ramp type dialogue

The cpt-city catalog has a lot of useful preset color ramps.

5. Choose Topography | Elevation. Note that cd-a and sd-a are also nice choices.

cpt city topography elevation

6. Click OK to close the dialog.

7. In the Layer Styling panel, click Classify to apply the ramp.

This gives us more intuitive colors in the DEM where we can clearly distinguish higher and lower areas.


Now we will further improve the visualisation.

8. Right-click on the dem_subset layer in the Layers panel and select Duplicate Layer.



This creates a copy of the dem_subset layer called dem_subset copy.

9. Uncheck the dem_subset layer, check the dem_subset copy layer and rename it to hillshade. You can do that by right-clicking on the layer name and choosing Rename Layer from the context menu.


10. In the Layer Styling panel, which should still be open, make sure that the hillshade layer is now selected. In the drop-down list change the Singleband pseudocolor to the Hillshade renderer.


Now the hillshade layer is visualised with a shading.

  • Which direction is the illumination coming from?
  • Is this possible in reality?

Hillshade gives the best results with an artificial illumination in the northwest, which in reality can not exist in the Northern Hemisphere. If you move the dial in the Layer Styling panel to the southwest, you will see an inverted relief. Also note that there is a Resampling section. The default resampling method for both Zoomed in and Zoomed out is Nearest Neighbor. This method is fine for categorical data however, elevation is considered continuous data. You should therefore choose a Zoomed in resampling method of Bilinear and a Zoomed out resampling method of Cubic.

Next, we're going to blend the DEM with the hillshade layer.

11. Switch on the dem_subset layer by checking the box.

12. In the Layer Styling panel make sure the dem_subset layer is selected. In the Layer Rendering block of the panel, change the Blending mode to Multiply.

layer rendering

As you can see, blending gives a much nicer effect than transparency. With transparency the colors will fade. Now we can clearly see the elevation differences: the gradient from south to north and the valleys where we expect the streams.



Blending modes allow for more elegant rendering between GIS layers. They can be much more powerful than simply adjusting layer Opacity. Blending modes allow for effects where the full intensity of an underlying layer is still visible through the layer above. There are 13 blending modes available. See here for more info.

Watch this video to check the steps of this section: