3

Background:

Using 3.26.3, I have a Geopackage point layer that I can successfully move the label locations using the Move Label button (below).

enter image description here

In the past, this process has automatically added two new fields to the layer attribute table, auxiliary_storage_labeling_positionx and auxiliary_storage_labeling_positiony.

However, in this case, those fields were not created. According to the layer's styling window (below), they were instead stored in the project.

enter image description here

This has confused me. I don't know how I caused the locations to be stored in the project. I would prefer to store them in the layer's attribute table, but the "Store data in the project" button is greyed out, preventing me from turning that off.

Question(s):

How do I convert this particular layer's label positions from the project to the attribute table? In the future, how do I inform QGIS where I want the label positions to be stored?

Postscript:

The layer's properties window has an Auxiliary Positions tab that mentions a "qgd" file. However, no such file exists for this layer. How does the presence or absence of a qgd file impact my situation?

enter image description here

2 Answers 2

1

When moving the first label, you must Select the primary key to use for joining with internal data storage.

Solution 1

When this is created (as it is the case with you), you automatically find two new entries in expression string builder when you expand Fields and Values, named auxiliary_storage_labeling_postionx and the same for y.

Simply create a new field with field calculator using these two entries:

enter image description here


Solution 2

There is another possibility: in the layer properties, go to Auxiliary Storage Tab. At the bottom, you find the option to export an Auxiliary Layer - a separate layer that contains attributes with the values of labeling_postion for x and y coordinates:

enter image description here

Exported auxiliary_layer, labeled here with the labeling_positiony attribute: it appears only where initial red labels were moved: enter image description here

3
  • Your response (thanks!) answers the first of my two questions. In retrospect, my second question was unintuitive; allow me to restate it here: When I first moved the label, using the Move Label button, QGIS did not add the two auxiliary_storage_labeling_position fields to the layer's attribute table. Instead, they were added to a qgd file (zipped in the project qgz file). In my previous experience with moving labels, the attribute table was automatically edited to include the two position fields. In this particular case, why wasn't the attribute table automatically edited?
    – Stu Smith
    Oct 5, 2022 at 21:01
  • I guess you should create a separate post for your second question as the policy of this site requires - here in the comments, the question risks to get lost.
    – Babel
    Oct 5, 2022 at 21:04
  • Fair enough. Will do.
    – Stu Smith
    Oct 5, 2022 at 22:43
0

Another way of solving this problem :

1- Make sure your layer have an id or unique field

2- When start working with the label moving tool, use that unique field as identificator

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.