1

I enabled labels for a streets layer in my QGIS 3.6.0 project via Properties > Labels > Single labels. The following screenshot shows an example of such labeling:

Street with multiple labels

How can I hide individual labels if the there are too many as in the example?

1

An easy method is to add a field to your layer, for example you can name it show_lbl. Make it integer type.

For the features where you want to show labels (I assume most of them), fill it up with the value 1.

For the features where you do not want to show labels, fill it up with the value 0.

Then in the label dialog, where you configure the label display options, add a filter like "show_lbl" >= 1.

Layer Properties | Labels | Expression Dialog

The feature labels should be displayed/hidden to your liking.

  • Thank you. I tried your solution. I also noticed that the column type can be boolean instead of integer. - One comment about user experience: I guess the idea is to make no-destructive changes to the layer which is a good idea. Even more user-friendly would be if there is an additional UI tool which allows the user to click and hide features while in the background such a column is created automatically. – JJD Mar 11 at 9:19
2

Under Layer properties > Labels > Placement > Repeat you can enter "No repeat" It's case sensitive so just like that. If the Label is generated from a Attribute and you have multiple features with the same attribute you may have to create a filter or use rule based labeling so that the label only displays on selected features. Is this the case?

This used under Layer properties > Labels > Rendering > Show Label:

regexp_match( "ELEVATION" , '.*00$')

limits the labeling on a layer displaying topo lines to only 100M increments. The data in the attribute ELEVATION matches 700 or 2500 or anything ending in "00" Not sure what attribute on your dataset distinguishes one feature from another. Create one if there isn't one already. hope this helps

2

If there is no particular rule to which labels you want to hide and you want to manually toggle visibility, try playing around with the in-built label editing tools in QGIS 3.x (if you don't see it it's under View > Toolbars > Label Toolbar).

  1. Select the layer you want to edit the labels for.
  2. Click on the label visibility button (see label with eye icon in screenshot below)
  3. Shift-click on the label you want to hide. The first time you do this, a popup should show up asking you to select a primary key; select an attribute that contains an UNIQUE ID (preferably numeric).

enter image description here

For multi-part features I have sometimes used the move label feature to reduce it to one label. You can reset the label to the default visibility by control-clicking and dragging your mouse across the area where the label used to be.

Note that the label positioning is saved within an auxiliary database in the qgis project and not your file itself.

For line features another thing you can try is under the label settings > Rendering (the paintbrush symbol at the end) check 'Merge connected lines to avoid duplicate labels'.

2

You could to use that, for avoid duplicate labels when they are connected Labels >> Rendering >> Feature options >> "Merge connected lines to avoid duplicate labels" See imageenter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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