Recently I upgraded to QGIS 3.26 on Ubuntu 22.04 and found that I was unable to edit my existing SpatiaLite database layers, i.e. the Toggle Editing tool bar icon could not be enabled. The screenshot below illustrates the problem.
While I have not found the cause of the problem, I found a simple workaround to the issue: just create a new SpatiaLite database and import the layers from the old database. The newly imported database layers can be enabled for editing.
Create a new SpatiaLite database
- In the Browser pane of QGIS, press the right mouse button on the SpatiaLite node.
A pop up menu appear. - Choose Create New Database.
- In the Name field, type in a new SpatiaLite database file name, e.g. new_rail.sqlite. Click Save.
The database is created.
Import layers from the old SpatiaLite database to the new SpatiaLite database
- If the layer e.g. node from the old SpatiaLite database e.g. rail.sqlite is not displayed in QGIS, then add the layer to the map window.
- In the QGIS menu, select Database | DB Manager.
The DB Manager dialog box appears. - Expand the SpatiaLite Providers tree node and double click on the newly created SpatiaLite database, e.g. new_rail.sqlite.
- Click Import Layer/File.
The Import vector layer dialog box appears. - In the Input drop down list, choose the layer from the old database, e.g. nodes. In the Output Table field, type in a new table name, e.g. nodes. Click OK.
The old layer is imported into the new database.
Displaying the newly imported Spatialite layer
- In QGIS, select Layer | Add Layer | Add SpatiaLite Layer.
- In the Connections drop down list, select the new SpatiaLite database, e.g. new_rail.sqlite. Click Connect.
- In the table list, select the new layer nodes. Click Add.
The new nodes layer is displayed in the map window. - Select the new layer nodes in the Legend pane.
The Toggle Editing icon is enabled now.
No comments:
Post a Comment