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?

  • Do your layers have different names? – user30184 Jun 1 '18 at 21:28
  • yes. Names are different. Otherwise they are identical (same geometry/attributes). – Ruslan Jun 1 '18 at 21:29
  • GeoPackage does not set such limitations. Perhaps QGIS does. With ogr2ogr it is for sure possible. – user30184 Jun 1 '18 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 Jun 2 '18 at 10:53
  • 1
    According to this post, the problem has been solved with QGIS 3: gis.stackexchange.com/questions/281201/… – Stu Smith Jun 3 '18 at 5:33
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

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

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.