I am labeling areas on a map (for example, forest (coniferous, deciduous trees), swampland, and so on). A cartographer has criticized it because labels which extend beyond the boundaries of the specific areas are cut off. Therefore, I would like to show only those labels that are completely contained within the area.

(I tried to work around the problem by masking the area with an internal buffer of the area's border, but that only cuts the labels along the buffer boundary.)

I would appreciate any ideas about how this could be accomplished with QGIS 1.80.

  • Thank you, whuber, for your assistance*
  • Please review and correct my translation, Andre, because it is a very broad rendering into idiomatic English of what I believe you are trying to ask.
    – whuber
    Jun 26 '13 at 13:47

This is a weakness in QGIS. The labeling in QGIS 1.9 allows you more control for label placement than even the alternative labeling method in 1.8 (Layer->Labeling as opposed to the labeling available from a layer's properties popup). In the 1.9 version you can specify to have the label centered within the visible portion of the polygon. (I just compared my 1.8 and 1.9 versions as I thought you might get these options in the former, but apparently not.)

enter image description here

However, centering in the visible portion of the polygon might help in many cases but it is not an absolute solution because 'visible' means the view and not what you see in the map composer, so while this helps a lot, you may still have some labels hanging off the edge.

There is s a second solution you can use (possibly in combination with using v1.9 or independently). You can use the advanced labelling options (in QGIS 1.8 you need to find this via Layer->Labels. In 1.9 it is in the Properties as in the image above). You can then apply data defined settings and set the position of your labels to ensure they are not cut. To simplify this, there are a couple of plugins that setup the required data fields for you (Plugins->Fetch Python Plugins and install either "Create Labelled Layer" or "Layer to labelled layer").

To minimise the manual effort involved in placing labels may I suggest the following work-flow: You already have created a buffer polygon for your 'safe area', so why not select all the polygons that intersect with the 'safe area' (and will therefore be visible), switch your selection (to the polygons which are not safe) and set their 'show label' field to nothing (thus turning off unsafe labels without having to manually move them).

  • Thank you for your detailed answere! I will try it out and will send a feedback
    – Andre
    Jun 27 '13 at 18:58

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