I try to save new generated layer to an existing GeoPackage. With "new generated layer" I mean to save layer by "save selected features as" or when I merge two layers or similar.

In the window I select Format = GeoPackage, File name = path with existing gpkg. When I want to click "save", Mac asks me to cancel or overwrite the existing gpkg. I can's select "add to existing gpkg". It does not even show up.

enter image description here

Why can I not save the layer to an existing gpkg? And how can I solve this problem?

I'm using macOS Big Sur Version 11.6 and QGIS version 3.16.6-Hannover.

5 Answers 5


I had no problem with saving selected features as a new layer into an existing GeoPackage with QGIS 3.18. Just give the name for the new layer and QGIS does not even ask further questions.

enter image description here

If user selects an existing layer for output then a new window opens. If the aim was to create a new layer user must cancel and change the layer name in the previous window.

enter image description here

It is also possible to add new layers into an existing GeoPackage from command line with ogr2ogr. The command would look like

ogr2ogr -f GPKG -update -append existing_geopackage.gpkg data_to_add.shp
  • But when I use this command, I first have to save the selected features as a shape file (somewhere local) and save this shape file to the GeoPackage in a second step. Did I understand that correctly? However, I like to do it in only one step (without saving a Shape File outside the GeoPackage first)
    – mymymy
    Oct 26, 2021 at 9:31
  • When you've chosen the GeoPackage in "File name" and clicked "save", there wasn't any message about overwriting? Maybe then they solved the problem in version 3.18 but not in LTR...
    – mymymy
    Oct 26, 2021 at 9:38
  • Yes, there is a message if I do not change the layer name. By default an existing layer ("polygon" in the example above) is automatically selected and then questions about what to do appear. That is not a problem for my mind.
    – user30184
    Oct 26, 2021 at 9:42
  • you don't get the message (see picture above) after choosing the GeoPackage in the Finder?
    – mymymy
    Oct 26, 2021 at 10:00
  • No. I am using QGIS 3.18 and saving selected features through Right click on layer name - Export - Save selected features as..
    – user30184
    Oct 26, 2021 at 10:16

Just to add to microlambert's reply, this is just an issue on Mac / OSX. I have filed a bug report at https://github.com/qgis/QGIS/issues/49351 but I am not sure whether QGIS can do anything about this.

It is an issue with the Qt library, and should be solved when QGIS moves to Qt 6 - this is in process - see https://github.com/qgis/QGIS-Enhancement-Proposals/issues/243 for details.

  • cool, thanks! we will see what they can do.
    – mymymy
    Nov 11, 2022 at 13:31

I have just been grappling with the same problem. The solution is just to select 'overwrite'. It won't do anything to your file at that point, just take you back to the processing window. Then run the process, and the output will be added to your GeoPackage as intended. No files are overwritten.

  • I've tried that as well and it worked, no other data was deleted. It's just not really trustworthy to click "overwrite"...
    – mymymy
    Nov 2, 2021 at 8:25

Yes unfortunately this doesn't seem to be possible. The interface is about exporting the selection and its current schema into a new table, as opposed to 'appending' data into an existing table. im on Windows, same version of QGIS though, but had the same problem with previous version, so its not a bug.

So just to confirm, the 'Save Select as' function is purely for creating new files.

As a solution With regards to appending data to an existing geopackage layer, I simply copy and paste from a selection. When the attributes are the same, it copies the attributes over as well as the geometry. This is probably the easiest method.

  • Thanks for your answer. Maybe my question wasn't clear enough. I'm using the GeoPackage as a small Geo-Database. I do have different tables in it (point, line, polygon layers). Then I want to save the selected features from a shape-file (which is not saved in the GeoPackage) to a new layer (or table with line geometry) inside of the GeoPackage. However, then I can only overwrite the whole GeoPackage instead of only adding it.
    – mymymy
    Oct 26, 2021 at 9:13
  • Yep thats ok, copy selected Features, then paste into the existing table will still work. If its a new table you need, then you can make the target layer writable, then select the target layer, and then paste............ I tend to use this method a lot because often there are fields I need to bulk populate afterwards.
    – nr_aus
    Oct 27, 2021 at 1:35
  • Thanks, that works for the selection of features only. But it won't for processes like "merge vector layers" or "clip features".
    – mymymy
    Oct 27, 2021 at 5:11
  • correct... merge and clip functions are their own 'thing' so to speak and will produce output files/temporary datasets, which then need to be migrated back to original datasets. - Some of the geoprocessing tools do have a 'Edit Features in Place' capability which gets around this, which you may want to check out. But its limited in the tools which allow this.
    – nr_aus
    Oct 28, 2021 at 6:39

I'm not sure why it's not working on you side. I've done few tests

I've tried to export to existing GPKG with right click on layer name in map layers tree, Export and Save Features As... and I'm able to create, overwrite file or only layer or append to layer. See below demo

SeeAdd to GPKG with layer Export

I've also tried to write to create a GPKG file and then try to add new layer to it using Processing script. See this other demo

Add to GPKG with processing

PS: tested on QGIS 3.16.3 on Ubuntu

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.