3

I have been trying to add multiple vector layers to a SpatiaLite database, however using the integrated DB Manager in QGIS 2.14.10 and 2.18.7, whenever I add a shapefile using the "Import Layer/File" button, and follow the menu, the item added does not have geometry, with only the attribute table appearing in the DB.

I can create DBs containing single layers using the "Save as..." right click menu option, but I can't save multiple vector layers into the same DB.

Other users have suggested using the QSpatiaLite plugin, however the plugin doesn't run when installed, and hasn't been updated in 6 years. QspatiaLite seemed like a good answer, if anyone knows of a similar plugin that has been upkept, please let me know.

Here is a snapshot of my SpatiaLite DB, with GLA_Zips being the vector file that was added to the original combined_mix sqlite file. Despite checking the geometry column option in the import menu, the geometry still isn't imported. When I click add to canvas in the context menu for the item, its added to the layers panel as a table, not a polygon vector file. DB Manager Screenshot

The original combined_mix layer looks like this in the DB, for comparison, and works in the layers panel just fine. originalSpatialiteFile

3
  • I can't reproduce with QGIS 2.18.7. I just added three layers to the same existing SpatiaLite db with the DB Manager and all the geometries are there.
    – user30184
    Commented Jun 7, 2017 at 5:38
  • Does the geometry appear after you hit refresh in DB Manager. If not, then try to update QGIS. It is now 2.14.15. May there is a bug in QGIS 2.14.10 that you have.
    – ahmadhanb
    Commented Jun 7, 2017 at 5:41
  • I just updated to 2.18.7 in the off chance that was the cause of the issue, and I am still having the same issue. I added a screenshot so you can see the DB I am working with, and the table that is shown when I add a vector file. And no, the geometry doesn't appear when I click refresh.
    – Fireycold
    Commented Jun 7, 2017 at 6:09

1 Answer 1

1

I created a test database with GDAL

ogr2ogr -f SQLite -dsco spatialite=yes test.sqlite point.shp

I made a connection with DB Manager and imported this same layer with another name.

enter image description here

Import was successful

enter image description here

I can see from your screen capture that even your "combined_mix" table does not have a point symbol in the legend like my layers do but I do not know if it means that there is something wrong with the database.

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.