Mastering Contour Lines and Labels in QGIS: A Step-by-Step Guide
In this guide, we’ll walk through the essential steps to extract contour lines from a raster file in QGIS, update their symbology, and add labels to make your map visually appealing.
Adding Your Raster Layer
To begin, you need to add your raster layer to the QGIS project.
Need some raster data to work with? click here
Extracting Contour Lines
Next, we’ll extract the contour lines from the raster file. Go to the menu and select Raster > Extraction > Contour. If you have multiple files, you can select the appropriate one from the dropdown menu.
For this example, keep the default settings for the band number and the interval between contour lines, which is set to ten. You can adjust this interval if needed. Ensure to save the contour shapefile to your project folder.
Styling the Contour Lines
After extracting the contours, you’ll want to enhance their appearance. Select the shapefile and access the properties either by double-clicking or right-clicking and selecting Properties.
Under the Symbology tab, change the color to black and apply the changes.
Adding Labels to Contour Lines
Now, let’s add labels to the contour lines. Right-click on your contour shapefile and select Open Attribute Table to view the elevation field that was created.
Go to the Labels tab in the properties window, switch from No Labels to Single Labels, and select the elevation field as the label value. Adjust the text size as needed.
By default, labels will appear above the lines. To change this, navigate to the Placement section and set it to display labels on the line instead. Apply the changes.
Creating Index Contours
If you want to highlight specific intervals, such as every hundred meters, you’ll need to create a new field called Index Contour. Open the attribute table and click on the field calculator icon.
Set the output field name to Index Contour and use an expression to identify the intervals. This will allow you to label contours at your desired intervals.
Enhancing the Map with Raster Layers
To improve the visual quality of the raster layers, you can duplicate the layer and change the symbology to Hillshade. Adjust the Z factor to refine the appearance.
For the top layer, switch to Single Band Pseudo Color and select an appealing color ramp. You can find numerous options available for selection.
Final Adjustments
Finally, remember to adjust the transparency settings so that the underlying hillshade is visible. This will give your map a more dynamic look.
With these steps, you have successfully extracted contour lines, styled them, added labels, and enhanced your raster layers in QGIS.
FAQ
What are contour lines?
Contour lines are lines drawn on a map connecting points of equal elevation, providing a visual representation of terrain relief.
How do I find DEM raster files?
You can find Digital Elevation Model files from various online sources, including OpenTopography.org.