7

I would like to use a centroid fill to enable me to place a letter inside a polygon. The advantage of using a centroid fill is that it also shows up in a legend, whereas labelling the layer would mean I have to put a text label on the legend in the composer.

The problem I have with the centroid fill is that the centroid can fall outside of the polygon, and as such my letter will not be within the polygon I need it to be.

I have included an example that shows where the centroid fills have worked, and one where it hasn't (the label shown in red):

enter image description here

Is there a way to force the centroid fill to be inside of the polygon?

Or is there another way to achieve this?

1
  • State your question clearly. From what you write it seems like you want a general geometric solution.
    – culebrón
    Jun 7, 2011 at 16:54

1 Answer 1

4

I've only found this work-around so far:

  1. You need to load the polygon layer twice.
  2. The lower layer is styled using the Centroid Fill option.
  3. The upper layer uses the same style but without the Centroid Fill layer.
  4. Enable labeling for the upper layer. Placement should be 'horizontal' or 'free'.
  5. In Print Composer, delete the upper layer from the legend items list.

This is far from optimal, but I don't think this special feature is going to be implemented soon into the renderer.

enter image description here

1
  • Thanks for the reply. This seems like the nearest I can get to what I want to achieve. As I am using rule based styling, I shall have to apply it twice to achieve this.
    – James S
    Jun 8, 2011 at 7:48

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.