4

I am using QGIS version 2.14.1 (Essen). I would like to place symbols on the centroids of my data. The problem is that some of my data has multi-part polygons, which means it places the symbol at the centroid of each mutlipart.

Is there anyway to place a unique symbol at the centroid of the polygon even if the geometry is a multi-part?

It works fine for single part geometries but not for multiparts.

4
  • 1
    At the risk of sounding obvious, can't you convert your layer to singleparts polygons?
    – ArMoraer
    Apr 25, 2016 at 15:23
  • I didnt really think of that because some multi part geometry is quite complex which emans the centroid would be false but if thats the only solution then i can try. How do I do this?
    – philippe
    Apr 25, 2016 at 16:17
  • Simply with Vector > Geometry tools > Multipart to Singleparts.
    – ArMoraer
    Apr 25, 2016 at 16:31
  • This doesnt work....I also tried editing directly the geometry but i have so much data its impossible to do manually.
    – philippe
    Apr 25, 2016 at 16:34

2 Answers 2

6

This feature is currently being evaluated to be integrated with QGIS 2.16 (and has good chances that it will be) will be part of QGIS with the 2.16 release and present on master builds from after Apr, 29 2016.

For a solution compatible with 2.14 see below.

enter image description here

enter image description here

Or if you want to use QGIS 2.14, use a Geometry Generator symbol layer.

CASE WHEN @geometry_part_num = 1 THEN centroid($geometry)
ELSE NULL
END CASE

(Sorry, not on a proper machine to verify this expression right now, it may be slightly different or more complicated, but there certainly is a possibility with a similar approach)

4
  • Is there a way to create the centroid for the biggest geometry part? Otherwise the geom generator result might be rather suboptimal.
    – underdark
    Apr 25, 2016 at 20:05
  • 1
    In the pull request, this is what is currently being discussed (tends towards: yes). With Geometry Generator probably also using order_parts( $geometry, 'area($geometry)', False ) and then only rendering the first part. Apr 25, 2016 at 20:08
  • @MatthiasKuhn Thanks for your help! Do you know when this new feature will be released? It is exactly what I am needing
    – philippe
    Apr 26, 2016 at 6:56
  • Release will be 2.16 (End of June) if you are not afraid of using development versions, a couple of days (or hours?). Note: this has not been officially merged yet, so no guarantee. Apr 26, 2016 at 7:02
2

This lacking feature / bug is known and reported at https://hub.qgis.org/issues/9199

For now, you could create a centroid point layer, remove potential unwanted points and symbolize that.

1
  • Yes I think that is what I am going to do but I have so many data points that it might take a long time!
    – philippe
    Apr 26, 2016 at 6:54

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.