New spatialite plugin for QGIS

For some time now it is possible to load SpatiaLite data layers in QGIS. It is read only though, any changes will need to be saved as shapefile.

There is a Spatialite manager plugin, which offers an interface to the database, with table view, table information, preview of the map, import of dbf files and a very basic SQL editor. Unfortunately, it doesn’t offer what I would consider a key function, the option to upload layers to the Spatialite database.

This gap has now been filled by the QGIS plugin QSpatialite. The author made it available a week or so back throught the standard QGIS contributed repositories. Make sure to enable third party repositories under the menu ‘Plugin – Fetch Python plugins – Repositories‘ and next under ‘Plugin – Fetch Python plugins – Options‘ select ‘Show all plugins except those marked as experimental‘. The author has released about 7 updates since the first experimental version and it is now pretty stable. It has a fairly intuitive interface, but for those who need it, there is also a basic help file.

Screenshot of version 1.3 of the QSpatialite plugin

The plugin offers a SQLite editor with function list. Clicking on it opens a list with functions that you can drag-drop into the editor, simple but very helpful. Queries can be saved as a (spatial) table and loaded directly into QGIS. You can view the table using the context menu, i.e., right mouse click on the table. I would have prefered a dedicated button or tab for this, like in the Spatialite manager plugin. But that is a minor thing and I can perfectly live with the current solution.

Other options available through the context menu are such management options drop table, create new index, trigger, view or table, rename table and show metadata. What I really like is that selecting one of these options will also show the SQL syntax.

Update 12/4/2011: Qspatialite has reached version 3.1 by now, with some new functionality I though to be worth pointing out. Especially the new query builder is a very welcome addition, as is the option to import text (txt/csv) files.

Update 2/5/2011: One function I was still missing in QSpatialite, the option to create a new empty Spatialite database, was added in version 3.3

To save the best for last, the option to import QGIS layers into the database. To my delight, this does not only work with shapefiles, but also imports loaded grass vector layers. It works like a charme, you just have to select the layer to import, specify the SRID and table name and optionally the characterset.

Second tab, where you have the option to import a table or QGIS vector layer in your Spatialite database.

Although I use mainly GRASS GIS, I have followed the development of Spatialite for some time now. And this plugin might make me go back using it for some of my work again.

Oh, and if you have any question about the plugin, go to the Google spatialite user group. The author is very quick to respond.

One thought on “New spatialite plugin for QGIS

  1. Pingback: Split strings in SQLite | Ecostudies

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s