6

In QGIS 3.22.0 (Bialowieza) I have a polygon layer of municipalities in Germany. Some municipalities consist of more than one polygon. I have duplicated the layer in order to make a categorization of a value within the layer. The categorization is displayed as a point-symbol.

My problem is that the municipalities with more than one polygon also show more than one point-symbol (attached image). How can I reduce the number of points and have the point only displayed in the largest polygon. (The municipality of Konstanz consists of three polygons.)

Enter image description here

2
  • What do you mean by "schon"? "show"? "already has"? Or something else? Jun 21, 2022 at 10:26
  • oh, thank you! Its supposed to be "show".
    – rtaani
    Jun 21, 2022 at 10:29

2 Answers 2

4

Have you tried to change symbol settings?

Layer Properties > Symbology > Symbol (arrow down) > Configure Symbol > Symbol layer type set on Centroid Fill.

At this point you should uncheck "Draw markers on every part of multi-part features".

enter image description here

2
  • This only works for multipart geometries, not for single parts. OP mentions that some municipalities consist "of more than one polygon".
    – Babel
    Jun 20, 2022 at 16:11
  • Thank you! I knew there was a setting, just couldnt find it!
    – rtaani
    Jun 21, 2022 at 6:11
4

If you want to create a marker only on the largest polygon of those with the same value for attribute name, use the Geometry generator with this expression:

if (
    area ($geometry) = 
        array_max (
            array_agg (
                area($geometry), 
                group_by:=name  --change this for the attribute field name
            )
        ),
    centroid ($geometry),
    ''
)

enter image description here

1
  • This didnt work for my case because i had already categorized the attributes. There was no need for generating geometries (it probably could've worked, but I'm still not that professional with expressions). Thanks for your help
    – rtaani
    Jun 21, 2022 at 6:13

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.