8

I am working in QGIS 3.4 with a geopackage file (SQLite database) containing orography information (points, lines and polygons). In QGIS, I have defined by hand a style for every layer in geopackage (gpkg). It's a time consuming task so I have saved layer styles in qml file, and also in the gpkg file. When I open my gpkg file in another QGIS session it works well showing every layer with their style.

Questions:

  1. I have problems when export the styled gpkg to another gpkg.

    The ouput file doesn't contain the layer_styles table so the styles definitions are lost. It doesn't matter if I export completely the gpkg stylized or only selected features. Of course I can apply .qml file but I would like to have the symbology stored in the geopackage.

    Maybe I have to check any specific option to export the gpkg file?

  2. By other hand, I defined different styles (3 or more) to the same layer and I saved these styles to the geopackage (they are well stored in layers_styles table).

    When I open my gpkg file in another QGIS session, only the default style is applied to the layer. Loading other styles from sqlite database doesn't apply to the layer and QGIS doesn't show any error message.

How can I use other styles saved in gpkg?

1

As far as i know there is no option for simple export that includes styles.

One option would be to programaticly create styles table in new layer and insert styles from source geopackage. I did not try his yet but it should be simple sql. Bit on this: Writing style information into geopackage with python and GDAL

Possible "dummy" workaround is to copy gpkg file and add layers into it instead of into new gpkg file. In this way you keep styles table. You can do this in Browser panel so you have control over content of gpkg file.

| improve this answer | |

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.