Saving layer styles to your Spatialite database

Just discovered this option in QGIS to save styles for Spatialite layers to the Spatialite database. I don’t know when this option was introduced (I am running the development version at the moment), but I am happy I found it.

Earlier I would open a layer, create a style and save the style as a QGIS style layer file for later use. Works fine, but not ideal if you are dealing with many layers and style files. Now, if you use a Spatialite layer, you have an additional option to save your style in the database together with your layer (I guess you’ll have that option too if you are working with PostgreSQL data layers?).

What makes this even better is that 1) the style is linked to the layer, 2) you can link multiple styles to the same layer, 3) you can easily switch between styles. See below a small demonstration.

Edit: And to give credit where credit is due, the work on this option was funded by the Piemonte regional administration in Italy (thanks Luigi Pirelli for pointing this out).


8 thoughts on “Saving layer styles to your Spatialite database

    1. pvanb

      I certainly do, thanks! One thing that could make this even better is an easy way to remove styles (perhaps a little delete button next to each style?)

  1. Stu Smith

    I do not see the save style to database option in QGIS 2.10.1. The only save style options are 1) QGIS Layer Style File and 2) SLD file. Or am I missing something???

    1. The option should be there if you open a layer from an Spatialite or PostGIS database. I.e., it won’t be there for a shapefile or other file based vector layers.

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