I have a road map in QGIS (v 3.22.1). I want to put labels on the roads, but since I get a label on each line segment there will be too many labels when there are many short segments, for example on highway crossing.
How can I avoid this? I am using a rule based labeling, so I thought
"vegkategori" = 'E' and length($geometry) > 2000
would stop labels on lines shorter than 2000m, but no. ($length neither did work).
Is there some other way of filtering out labels on short lines? – or what would be perfect – a minimum distance between labels on the same data set.
Best Answer
It is a native feature in QGIS. Select your layer, right-click > Properties > Label. Then select
Rendering
and scroll down.You will fine the wanted option (blue color on screenshot). A nice alternative would be to connect lines to prevent unwanted labels (green color on screenshot)
Merge connected lines to avoid duplicate labels