2

Is it possible to move the labels in a fixed Layout (not in the MAP frame using the Label Toolbar)?

Even with adding in advanced label functionality (all mapping programs) don't always get the labels exactly where they look best.

Rather than exporting to SVG and making the changes in an illustrator program can we just move the labels in the layout? Maybe like in ArcMap convert the labels to annotations and then move them?

A similar question is - https://www.reddit.com/r/gis/comments/h7q5qk/move_labels_in_qgis_layout_view/

EXAMPLE

Here's a layout... notice the labels aren't in the best place as it's difficult to work out which label refers to which icon. I have tried different settings and callouts to fix this automatically.

enter image description here

Most of the labels are OK, I don't want to have to create Text Labels in the layout for all these. I'd just like to be able to convert all the text labels in a layout with automated labels to some other format (annotation) and manually move them before printing to PDF. The alternative is SVG and illustrator which is just another step that needs to be redone if the underlying data changes. Unfortunately, the SVG output is buggy as well -so it crashes qgis on bigger projects.

Basically the features in https://desktop.arcgis.com/en/arcmap/10.3/map/working-with-text/converting-labels-to-annotation.htm

4
  • 1
    As it is fixed in the layout i would use a text label in the layout. If you want to update the text label content based on the map you can use the expression builder. Can you explain wich kind of information or label content you would like to display ? Commented Nov 26, 2021 at 10:54
  • Thank you - I have added an example. As far as I know, expression builder for the text labels won't give me access to the attributes of a particular point.
    – GeorgeC
    Commented Nov 26, 2021 at 22:31
  • 1
    Ok i get it. It is not only one or two but many with style and so on. You can access data of a specific point with expression builder but it is long to do. I will try to do an answer soon. Commented Nov 27, 2021 at 8:40
  • Thanks. The example data / layouts etc in gis.stackexchange.com/questions/416973/… can be used for this question as well.
    – GeorgeC
    Commented Nov 27, 2021 at 9:40

1 Answer 1

1

For your label question, there are many solutions. Here is what I would do :

I would use attribute table to set the position right or left of the point. The reason : It is a strong solution it need not so much time, you could change any other layer you want, it is easy to set, and you are sure to always get the same result.

In your layer used for label create a field named position which will contain text : L,R. You can use the field calculator to do so.

Use the label Placement mode Cartographic. Set the distance to be 3 mm (more or less). Set the Position priority to be data driven by the field you just created.

enter image description here

This will postion your label first on the left side and if it is not possible it will be in the right side. Update your layout and check if label are fine, if not you have to change the position attribute to be :

  • L to get label on the Left side
  • R to get label on the Right side
  • Or other value possible : TL=Top left|TSL=Top, slightly left|T=Top middle|TSR=Top, slightly right|TR=Top right|BL=Bottom left|BSL=Bottom, slightly left|B=Bottom middle|BSR=Bottom, slightly right|BR=Bottom right

When it is alright, you could save your layer and do your export.

4
  • Great suggestion. I tried a variant of this by using the rule based to set some to be left, some to be right only but the issue was that when it's blocked no label shows up. I tried a comma separated list of the position both as L,R or 5,6 etc. Are you able to enter a list?
    – GeorgeC
    Commented Nov 29, 2021 at 20:36
  • You can enter a list of different values like the one you enter in the newly created colum 'L,R'. It will try first to be rigth then left and then not to be shown. You can add many possibility of position or check the always show the label option. Commented Nov 30, 2021 at 1:43
  • I tried but it gives me an error in the current 22.1 v of qgis.
    – GeorgeC
    Commented Nov 30, 2021 at 1:49
  • 1
    I haven't tried in QGIS 3.22. Can you try with a text directly in the expression builder. Normaly the expected format is : Comma separated list of placements in order of priority [TL=Top left|TSL=Top, slightly left|T=Top middle| TSR=Top, slightly right|TR=Top right| L=Left|R=Right| BL=Bottom left|BSL=Bottom, slightly left|B=Bottom middle| BSR=Bottom, slightly right|BR=Bottom right] Commented Nov 30, 2021 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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