2

I have a point layer and would like to label it. I would like to create the label from the "brts" column. This column contains digits. Several objects can have the same value in this column. If two objects have the same value, only one object should be labeled.

I have already tried it with an expression for the label value:

CASE 
WHEN count(1, "brts") > 1 THEN ''
ELSE "brts"
END

With this, however, only the objects with a double value in the "brts" column are no longer labeled at all. How should I complete the expression so that only one of the affected objects is labeled?

I am using QGIS version 3.28.15LTR

1 Answer 1

6

To only label the feature with smallest $id value from the featuregroup with the same brts value, use this expression:

case
when $id=minimum($id, group_by:=brts)
then brts
end

Red label: what you want to achieve; black labels to show the brts value of each point: enter image description here

Your Answer

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

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