7

I created a GeoPackagein QGIS 3.18 that contains different entries (layers).

How can I delete just on entry of this GeoPackage?

2 Answers 2

14

In the browser panel, browse to the Geopackage and expand it. Right click the layer you want to delete and select Delete layer.

enter image description here

5
  • Actually even better than using DB Manager. The Browser-Way offers a little more options like removing single fields or exporting the file as a new one.
    – MrXsquared
    Commented May 3, 2021 at 15:34
  • Didn't think about the DB manger , so learned something too :-)
    – Babel
    Commented May 3, 2021 at 15:56
  • Amazing!! Thanks for your help
    – Markus
    Commented May 4, 2021 at 8:41
  • 1
    @Markus, accept the answer with the checkbox
    – Bera
    Commented Nov 9, 2021 at 8:24
  • 1
    Any idea about how to delete a raster layer from a Geopackage? The browser panel or DB Manager aren't working.
    – Leo
    Commented Jan 18, 2022 at 23:37
5

Open Database -> DB Manager

Then create a connection to your desired Geopackage file by right clicking on Geopackage -> New Connection

Now you can see the layers. Right click the one you want to delete, and press delete.

enter image description here

5
  • But don't be surprised if it doesn't work. It seems to be easier to add them than remove them in 3.18 on Mac.
    – wingnut
    Commented May 3, 2021 at 15:30
  • @wingnut no issues here on 3.18 windows version.
    – MrXsquared
    Commented May 3, 2021 at 15:32
  • I tried about ten times, but layers refused to delete. Restarting didn't help. I eventually tried to do it with SQLITE, but it corrupted the GPKG. Fortunately, I had a backup. Otherwise, GPKG is nice to store the project and its layers in a single file. I would again only do it at the end of the project so I don't have to delete anything.
    – wingnut
    Commented May 3, 2021 at 15:41
  • 1
    hm, cant test on a mac.. only reason I can think of that the file/layer might be in use at that time? Anyway, consider making a report at QGIS issues site if that persists.
    – MrXsquared
    Commented May 3, 2021 at 16:06
  • I created the GPKG on Windows and moved it to the Mac. It read it OK, just couldn't delete any layers. Deleting the lock file didn't help either. Next time I try, I'll submit something if necessary.
    – wingnut
    Commented May 3, 2021 at 19:10

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.