7

I am just playing with the GeoPackage format in QGIS. In QGIS it works nice with the style saved from QGIS but if I load it for example in SAGA the style is not applied.

Is there any way to include at least some basic style (for example point colors for value ranges or classes) so it could be used by different applications? Or is the included style always "application-specific"?

  • You could add columns to the attribute table for color, symbol shape, etc. – csk Mar 6 '18 at 17:16
  • but the user has to built a new style from them manually - am I right? – Juhele Mar 12 '18 at 10:27
  • It depends on the program. In QGIS, if you use the same column names in multiple layers, you can create one style and load it for each layer. So it saves you a few steps, but you still have to create the style in the same program. I don't use SAGA, so I'm not sure how it would work with that program. – csk Mar 12 '18 at 16:56
  • I know that I can easily copy style in QGIS and easily use copy of the same qml file for several shp layers to load them with the style in QGIS. I also know that I can save the QGIS style to Geopackage to be applied same way as the qml with shp. However I was curious whether the Geopackage standard also contains some universal style definitions which is compatible in more apps supporting Geopackage format. – Juhele Mar 13 '18 at 8:33
  • Is it possible to do this by python code ? – Feneck91 Jun 24 at 14:50
6

QGIS support its own format QML and SLD. When you use GeoPackage (or PostGIS) you can save the style on the GeoPackage and distribute both the data and the style. On the layer properties, the Style button has an Save Style option and you can choose Save in database (GeoPackage).

enter image description here

The style is saved on a table inside your GeoPackage called layer_styles. The style is saved as QML (on styleQML column) and also saved as SLD (on styleSLD column).

enter image description here

Other softwares, like SAGA, GeoTools, etc, could support this same approach, reading the layer_styles table, if present, and use the SLD style stored in the GeoPackage.

Try to convince SAGA developers to support SLD. If SAGA gets SLD support, we could use and share the SLD style saved on the GeoPackage.

  • Can you post a small bit about how you save the style to geopackage? – DPSSpatial Mar 17 '18 at 18:25
  • I've added more details about saving the style in the database to the answer. – jgrocha Mar 18 '18 at 21:22
  • OK, thanks for the information about saving SLD in the GPG - I thought it just adds the QML which is QGIS-only. I will ask my friend to load my files in other programs to see which other are able to load the SLD style. – Juhele Mar 18 '18 at 23:27

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.