7

I am using QGIS 3.2.0 and I want to share auxiliary data between projects but I could't find how to do that.

I tried to "play" with auxiliary layer export but there is no auxiliary layer import.

Also I tried and just duplicated and renamed .qgd file of the first project but no solution.

See screenshots:

enter image description here

enter image description here

7
  • What is "auxiliary data" for you?
    – Erik
    Commented Jul 2, 2018 at 13:00
  • @ErikLohmann I changed XY position of labels using auxiliary layers, I want to use the same positions in another project and I don't want to do the same manual work second time.
    – Dan
    Commented Jul 2, 2018 at 13:10
  • Sorry, I can't follow you there. Why did you use layers to position your labels, and didn't simply work with the properties-settings?
    – Erik
    Commented Jul 2, 2018 at 13:18
  • @ErikLohmann it is an annotation layer. What I am doing needs such actions. I am just curious if it possible what I asked above.
    – Dan
    Commented Jul 2, 2018 at 13:28
  • 1
    It seems you're trying to use auxiliary data in a way not intended by the QGIS developers. Auxiliary data is not designed to be transferred between QGIS projects. If you need to do so, do it the way eurojam suggested by saving each auxiliary storage field as an attribute table field. Then use those fields for data-defined label positions in the new project.
    – csk
    Commented Jul 3, 2018 at 21:19

2 Answers 2

4

you can move the data stored in the auxiliary storage with the field calculator into your dataset:

screenshot from field calculator

3
  • what you say doesn't relate with another project. If you copy that layer into another project you won't see those auxiliary fields anymore.
    – Dan
    Commented Jul 3, 2018 at 13:29
  • that is right. but you can use them furthermore for datadefined positions of the labeling
    – eurojam
    Commented Jul 3, 2018 at 14:08
  • but in this way you are creating and creating new fields, that is not what I want.
    – Dan
    Commented Jul 3, 2018 at 14:47
3

I ran into this same problem just now, with the added difficulty of trying to move auxiliary data (label locations) from a project in QGIS 3.16 to another project in QGIS 3.28. The trick is to understand that a .qgz project file is actually a zip archive of (usually) two other files: a .qgs project XML file, and a .qgd auxiliary sqlite database file. That means that if we unzip a .qgz file, we can access its auxiliary data database and modify it as necessary.

Here are step-by-step instructions for copying label position auxiliary layers from one project file in QGIS 3.16 (P1.qgz) to a second project file in QGIS 3.28 (P2.qgz):

1. Make QGIS create the auxiliary label position layers in P2.qgz
  • Open P2.qgz
  • Select the layer with the labels of interest, and go to Layer Properties > Labels > Placement > Data Defined, and check the "Store Data In Project" box for both X and Y, then click OK
  • Use the Move Label tool on a label in that layer
  • Follow the prompt to choose the key
  • Move the label once
  • Select the layer again and go to Layer Properties > Fields to ensure that the auxiliary label position layers have been created
  • Save P2.qgz and close QGIS
2. Unzip the project files
  • Copy P1.qgz and P2.qgz to a separate folder
  • Using 7Zip or another compression utility, extract the contents of the copies of P1.qgz and P2.qgz - each one should contain a .qgs file (project information in XML) and a .qgd file (auxiliary database)
    • Side Note: It seems that at some point after QGIS 3.16, some project information was migrated into a new oyJZbS_styles.db file, so you may see that, too
3. Access and modify the auxiliary data using a SQLITE Database Manager
  • Download and install DB Browser for SQLite (any SQLite DBMS should work)
  • Open DB Browser, click Open Database, and select P1.qgd
  • Open a second instance of DB Browser, click Open Database, and select P2.qgd
  • In the DB Browser window with P2.qgd, select the table containing your label position data and delete it
  • In the DB Browser window with P1.qgd, select the table containing your label position data and drag it into the window with P2.qgd
  • In the DB Browser window with P2.qgd, click Write Changes to save your changes to file, and close DB Browser
4. Re-zip the project files
  • Select all of the P2 files and use your compression utility to compress them back into a zip archive (P2-new.qgz)
  • Move P2-new.qgz back to its original folder, and open it up to test that the label position data is being interpreted correctly. If it is, replace the old P2.qgz file with the new one.

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.