This question already has an answer here:

I have a contour vector layer with a step 0.2m . I want every 1 metre, to change the line style, a thicker line for example, and the rest of them,symbolize with a dotted style. So, I can do it manually, categorize the layer, and at each metre,change the style, or I can copy the file, paste it and delete all the Real numbers, leave the integers only, and style them as I like and put the layer over the original. My question is if I can do the same job with the "Rule-base" style. If there is a formula which can locate the integer numbers and make them a category, so I can finish my job quicker.

marked as duplicate by underdark qgis Oct 27 '17 at 13:37

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Try to do the following formula at Rule-based Style

"FieldName" % 1 = 0    (Assign thick lines for 1 meter interval lines)
ELSE                   (Assign thin lines or any other style for other interval lines)

enter image description here

In the above image "Elevation" is the name of the field that holds the contour elevation.

  • It works perfectly, thank you ahmadhanb, also thank you for the explanation in the parenthesis. – Pitheas Oct 27 '17 at 12:52
  • You are most welcome. Glad it worked :) – ahmadhanb Oct 27 '17 at 12:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.