I am displaying symbols at the middle of lines and I would like them to be visible only when the length of the feature displayed on my screen is long enough (which I call "visible length" in the title of this message).

I found a workaround using a condition based on map scale:

enter image description here

if(@map_scale>5000, $length>50, $length>30)

Is there a way to do it at any scale? For example a condition saying "don't show the symbol if the feature length on screen is less than X cm"

1 Answer 1


Simply calculate the length on the map canvas using $length / @map_scale and than check if this is longer than the threshold you want: $length / @map_scale > X (don't forget to convert units from project CRS to cm).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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