0

I have a bunch of variables to map with same geometry (Regional Boundaries), and wanted to create separate layers with differing attributes within a single geopackage file for ease of file management. However, when I save the duplicate layer into a geopackage I get an error "Export to vector file failed. Error: Cannot overwrite a OGR layer in place". This seems to be expected behavior according to this bug report. Is there a way around this? Creating separate gpkg files for each layer seems to be unnecessary/superfluous. Or am I misunderstanding the entire concept of geopackage as a an analogue to Esri's geodatabase?

12
  • Do your layers have different names?
    – user30184
    Commented Jun 1, 2018 at 21:28
  • yes. Names are different. Otherwise they are identical (same geometry/attributes).
    – Ruslan
    Commented Jun 1, 2018 at 21:29
  • GeoPackage does not set such limitations. Perhaps QGIS does. With ogr2ogr it is for sure possible.
    – user30184
    Commented Jun 1, 2018 at 21:38
  • the bug report doesn't say it's expected, just that it looks that way to the program. reopen the bug report and make it clearer why this is an issue
    – Ian Turton
    Commented Jun 2, 2018 at 10:53
  • 1
    According to this post, the problem has been solved with QGIS 3: gis.stackexchange.com/questions/281201/…
    – Stu Smith
    Commented Jun 3, 2018 at 5:33

2 Answers 2

2

Thanks to @user30184 for an answer, that prompted me to discover a workflow that works even better for me. Since my original question was nested in need to create multiple thematic layers (primarily based on excel sheets + attribute joins), I discovered that doing a join on a layer and then saving it into the geopackage does not prompt any errors. So instead of duplicating layers and then attaching attributes through table joins, it is easier to do joins first and save files after (as output from the join), then there are no errors and duplicate geometries are saved into a single GPKG.

1

Instead of using the Save as... option use the DB Manager tool. In the example below I had opened layer "test_2" from GeoPackage "test" and I imported it back to the same GeoPackage with a new name. I tested that is is possible to import duplicated layers in the same manner.

enter image description here

2
  • Which QGIS version did you use?
    – Stu Smith
    Commented Jun 18, 2018 at 5:24
  • Version seems to be 3.0.3.
    – user30184
    Commented Jun 18, 2018 at 6:07

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.