3

The following expression is used to label duplicate geometries avoiding text overlap:

array_to_string(
    array_prepend(
        overlay_equals('POINT_LABEL',VALUETEXT),
        "VALUETEXT"
        )
    )

Although the function works perfectly and the labels do not appear overlapped (as shown in the screenshot), I would like to solve the problem of repeated labels being displayed. The repetition is happening because all the geometries are being labelled.

I think that a solution could be to group the repeated values for every duplicate geometry, since eliminating duplicate geometries is not a possibility in my project case. Or maybe there is a different solution approach.

  • Current result:

    enter image description here

Expected result:

enter image description here

1 Answer 1

5

This is not optimal, but I was only able to find this solution. It would be better to call it a workaround. It may display a different result for your data.

array_to_string( 
  array_distinct(
     overlay_nearest('POINT_LABEL', VALUETEXT)
  ),
  delimiter:='\n'
)

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.