QGIS allows groups of layers to be saved as a 'layer definition file'.

Where one layer in that group references another - using a 'value relation' widget on its attribute form - these setting are broken once the layer definition file is imported into a new project.

Is there a workaround or alternative, bearing in mind that too many value relations are used to allow them all to be fixed individually by hand every time a layer definition file is imported?


Use case/details:

Data is stored in a PostGIS database.

I have two complex QGIS projects, used as standard template projects by large teams. Each team has information it focuses on, but they also need to view the information from the second team. The projects are therefore fairly similar, but slightly differently organised. On updating the way that one of the projects works I need to update the second project accordingly.

There are two obvious ways to do this. The first is by saving groups of layers and importing as embedded projects. QGIS 3.4 currently seems to fail to work with these in a number of ways (losing settings around visibility in particular) so I abandoned this system. The second is to export/import groups of layers in a 'layer definition file'.

I use multiple 'value relation' widgets, with some simple data tables (also stored with the main data) providing the content for drop down lists on the main layers. These work well. It is important that the potential values for the drop down lists are stored within the database (not in the QGIS project).

Unfortunately the settings for the 'value relation' widgets don't correctly import along with the layer definition file (internal references in the file, between the layers, are broken - these could be corrected in a text editor, but such a process is laborious and error prone).

Is there a workaround or an alternative? Such a workaround should recognise that in my case updating things field by field is impractical due to the large number of such value relation widgets (referencing multiple, different layers), and that the values for the drop down boxes should still be stored in the main database and not in the QGIS project.


Your Answer

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

Browse other questions tagged or ask your own question.