Welcome to another QGIS tutorial. In this article, we will learn how to select contours at a specific interval. I will show you how to select and then symbolize the contour lines every 50 meters. Below, you can see my contour layer is displayed using single symbology. So, all the contour lines have the same symbol and color.
Below, the same contour layer was treated using a categorized symbol on every 50 meters contour. As you can see the dark red contour lines are the 50-meter interval and the grey thin lines are 5 meters.
How can we achieve this?
First, we need to create a categorized symbol. Double-click the contour layer and then go to the Symbology tab. Choose the Categorized from the drop-down list. And then, click the Expression Dialog button to open the Expression Dialog window. Now type the following lines in the dialog window.
CASE WHEN alti%50 = 0 THEN 'interval 50' ELSE'interval 5' END
You will need to change the alti with the actual elevation field/column in the contour layer. The code above will select all the contours that have the elevation value of 50, 100, 150, and so on. And then save the interval as interval 50. Other than that, we will save the interval as interval 5.
Click OK and then click Classify button. You should see the new categories shown on the Symbology window as shown below.
Next, change the symbology for each category such as the line color and weight.