Each time I save a layer from QGIS as a spatialite it insists on creating a new db ( if you select a existing db you are asked whether to cancel or replace).

I want to package all the layers of a project into a single spatialite db for distribution.

I figure that I can use native sqlite tools to combine the layers from the individual files but it would be nice not to have to do so.

2 Answers 2


You can create an empty SpatiaLite database using Layer > Create Layer > New SpatiaLite Layer. Once you've done so, it will appear in the DB Manager (an included plugin; enable from the plugin manager if it is disabled). Alternatively, if you have an existing database you would like to add layers to, add it with Layer > Add Layer > Add Spatialite Layer (not with Add Vector Layer). This will make the SpatiaLite database appear in the DB Manager

Once you have done either of the above, you can use the DB Manager to import any layer loaded in QGIS, of any origin, to the SpatiaLite DB.

I believe this to be a better option than using Qspatialite, as DB Manager is a core QGIS plugin and maintained by the QGIS team.

  • How do you import a layer to the SpatialLite DB using the DB Manager? I tired it but when using simply the "Import layer/file" menu the geometries are lost.
    – Bushroot
    Commented Jan 31, 2018 at 20:06
  • In Db manager, you can simply drag and drop a table from (for example) postgis database to spatialite database Commented Sep 4, 2021 at 5:38

give the qspatialite plugin a try (https://plugins.qgis.org/plugins/QspatiaLite/)

(Create empty db, now you can select all your layers and add at one go. see screenshot 1)

Saving layers into  db

Retrieving layers from db

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.