geofileops.add_layerstyle#

geofileops.add_layerstyle(path: Path, layer: str, name: str, qml: str, sld: str = '', use_as_default: bool = False, description: str = '', owner: str = '', ui: str = '')#

Add the layer style to the geofile.

Remark: at the time of writing, QGIS only uses the qml field to interprete the style, so this field is mandatory and sld is not.

The style is saved according to the QGIS Geopackage styling extension: pka/qgpkg

Parameters:
  • path (Path) – path to the geofile.

  • layer (str) – the layer the style is meant for.

  • name (str) – the name of the style.

  • qml (str) – the styling in qml format.

  • sld (str, optional) – the styling in sld format. Defaults to “” as it is not used by QGIS at the time of writing.

  • use_as_default (bool, optional) – True to use the style by default when opening the layer in QGIS.

  • description (str, optional) – description of the style, Defaults to “”.

  • owner (str, optional) – owner of the style, Defaults to “”.

  • ui (str, optional) – ui specification in ui format, Defaults to “”.