1

I have a QGIS GeoPackage storing several vector layers and three projects.

The QGIS User Guide, chapter 6. Working with Project Files, states: ‘The information saved in a project file includes ‘Layers added’.

The User Guide chapter is really talking about saving a project which are saved to QGS/QGZ files.

My question is: in a QGIS GeoPackage, which contains multiple projects, could each project include its ‘Layers added’, too? If that is so, how do I achieve this?

My problem is that each of the three projects within my GeoPackage includes identical set of layers chosen from the packaged layers in that GeoPackage: removing a layer from one project, also removes that layer from the other two projects in the GeoPackage; adding a layer to one of the projects, the same layer is automatically added to the other two projects in the GeoPackage.

Is there a way to make a different selection of layers for each project within a single GeoPackage?

2
  • 1
    I think you're confusing things a bit. a GeoPackage contains data, like tables of points and polygons. A project stores your connections to those data.
    – Encomium
    Dec 7, 2021 at 13:46
  • Have a look at menu Project - Save To - GeoPackage. It is possible to save also the project into GeoPackage.
    – user30184
    Dec 7, 2021 at 13:54

1 Answer 1

1

In principle, the answer is yes: you can store inside one and the same Geopackage file different layers + projects. Projects can have loaded different layers, but you should add them inside the project. Geopackage is a container format, imagine it like a folder or a zipped file, containing multiple files and folders.

However, functionality depends on QGIS version and there might be bugs. Saving projects to Geopackage was introduced in QGIS 3.8. So even if in principle it should work, the very reason why it does not as expected depends on the very context: your QGIS version, Operating System, the file and data you use etc.

And: even though you can store everything in the same Geopackage, for practical reasons it still might not be the best idea - this is good for sharing whole projects + data, but for productive use and to keep an overview, I would still keep data and projects as separate files.

5
  • Could you, please, elaborate on your suggestion that I ‘should add them [layers] inside the project’. – This is precisely my query: how? – As I understand it, to add layers to a project (i) set the project: Project menu > Save To > GeoPackage … > selecting the relevant GeoPackage project from the Project drop down list; (ii) add the project’s layers: Layer menu > Data Source Manager > GeoPackage tab > selecting the relevant layers and clicking the Add button; the selected layers show up in the Layers panel and the map canvas. I run QGIS 3.20.0 on a desktop computer with Windows 10.
    – Pavla
    Dec 7, 2021 at 16:22
  • Yes, that seems correct. However, to see in detail what works and what not, inspecting you Geopackage would be good.
    – Babel
    Dec 7, 2021 at 16:30
  • Thank you so much for your help; I am not sure how to go about sharing my GeoPackage for your to ‘inspect it’. - I will put together a package with just one or two layers from the QGIS online tutorials and see if I can reproduce the issue.
    – Pavla
    Dec 7, 2021 at 17:01
  • Yes, you should upload it to a cloud and share the link here.
    – Babel
    Dec 7, 2021 at 17:09
  • Yes, packaging just 5 shapefiles from the QGIS exercise data to a GeoPackage and then adding two projects to the GeoPackage exhibits exactly the issue I described: the result of adding/removing a layer from one project is automatically reproduced/mimicked in the other GeoPackage project. - The projects in the GeoPackage, I am developing, share many of the GeoPackage layers. I hoped, that each of the projects would have their own set of layers, too, to deal with a particular aspect I wish to explore. I thought, it would be simpler to switch between the projects within only one ‘container’.
    – Pavla
    Dec 7, 2021 at 18: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.