2

How can I pin all my labels in QGIS 2.2/2.4 (Data Defined Labels) without clicking every single label?

6

This can be tricky if you have many layers. The label pinning tool only works on labels that are actively being shown, i.e. after the automated positioning is calculated and the labels drawn. Pinning (using a definition of 'pinning' a label at its current position) by default requires a label to be drawn first. You usually can't just edit your attribute table's X and Y columns to define label coordinates, unless it is a point layer and you know exactly how you want the labels to drawn, e.g. always upper right quadrant.

The pinning tool allows you to drag a marquee over the whole canvas; however, by default there is a high likelihood that some labels will not be shown at zoomed-out scales, like when viewing full extents of all layers.

The trick is to to do the following:

  1. Turn on 'Show all labels and features for all layers'

    enter image description here

  2. Ensure the labeling of your layers is not limited in other ways, e.g. only at certain zoom levels or pixel sizes, etc. By default, any label whose height is sub-pixel will not be shown. So, there is a limit to how far you can zoom out, if showing labels using map units.

  3. Toggle the Highlight Pinned Labels tool, so you can see the labels highlighted relative to whether they are pinned and their current edit mode state (green = pinned and editable, blue = pinned and non-editable).

  4. Zoom to the full extent of an individual layer. You may have to zoom out one more step to ensure all features are comfortably inside the canvas. (You can adjust the zoom factor in Options | Map Tools to something like 1.1 to make the step smaller.) Optionally, you can hide all other layers while you are working on the current one. The pinning tool does work on all layers in edit mode and showing labels, though.

  5. Put the layer into edit mode (assuming the attribute table is already set up for X/Y columns) and drag a marquee across the full canvas to pin labels. It may take a long time if you are pinning a huge quantity of labels.

  6. Save edits for the layer and exit edit mode.

  7. Repeat steps 4, 5 & 6 for all layers whose labels you want to pin.

1
  • I never tried it that way. I did not know that is that easy! Thanks!
    – MAP
    Jun 12 '14 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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