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.


1 Answer 1


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, 2017 at 12:52
  • You are most welcome. Glad it worked :)
    – ahmadhanb
    Oct 27, 2017 at 12:53

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