I have a couple of default styles stored in a spatialite db. When I add the layer for which I have defined the default style in QGIS 2.14.22, everything looks good but trying the same in QGIS 2.18.16 sets only a generic style (cp. screenshot). The layer_styles
table looks like this:
Added a layer with default style in QGIS 2.14.22:
Added the same layer in QGIS 2.18.16:
Note that I am able to manually load the style from the database in 2.18, and everything looks like expected, but I need to load the default style automatically when adding a layer. QGIS 2.18 can obviously load the style from the table, but does not recognize the default correctly.
The styles are created and stored with QGIS 2.14., so are there any compatibility issues that I miss?
Answer
The problem is in the f_table_catalog
column which is empty in my case. QGIS 2.14.X seems to ignore this and can assign a style to its table by only the table name. QGIS 2.18.X obviously needs this column set to the path/filename where the spatialite db resides. If the field is empty, or the db has moved to another location QGIS 2.18.X is not able to assign default style to a table.
I solved this at this point by setting the f_table_catalog
attribute for each dataset to the db location, which is easily done either in QGIS multi edit mode or via QGIS DB Manager/SQL Window:
update layer_styles set f_table_catalog='path/to/my/spatialite.sqlite'
No comments:
Post a Comment