Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
State your question clearly. From what you write it seems like you want a general geometric solution. –  culebrón Jun 7 '11 at 16:54

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
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 '11 at 7:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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