3

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:

enter image description here

Added a layer with default style in QGIS 2.14.22:

enter image description here

Added the same layer in QGIS 2.18.16:

enter image description here

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?

3

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'
  • 2
    Ha! Isn't this woth raising an issue? I think loading default style from db should work even if the spatialite db is move somewhere else... – Eva Großmann Feb 28 '18 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.