Skip to main content

bridge-style

License: MIT CLA assistant

bridgestyle is a Python library that allows you to convert cartographic symbology formats.
It uses GeoStyler (JSON) as an intermediate format, and follows a two-step approach:

  1. Convert from the supported original format into the GeoStyler format.
  2. Convert from GeoStyler into a supported destination format.

Supported formats

In the table below you'll find the symbology formats that can be converted from one to another. The first column shows the source formats, and the first row shows the destination formats:

QGIS (QML) ArcGIS Pro (CIM) GeoStyler SLD (GeoServer) MapLibre GL JS Mapfile (MapServer)
QGIS (QML) n/a
ArcGIS Pro (CIM) n/a
GeoStyler n/a
SLD (GeoServer) n/a
MapLibre GL JS n/a
Mapfile (MapServer) n/a

As you can see, the current main goal of this library is:

  • to convert QGIS symbology via GeoStyler into all other formats
    OR
  • to convert ArcGIS Pro .lyrx files via GeoStyler into all other formats except QGIS.

⚠️ WARNING ⚠️
Converting from QGIS symbology (QML) into something else requires the QGIS Python API. In that case, you can only use this library in a QGIS runtime environment.

ArcGIS Pro users can create a Python toolbox that utilizes bridgestyle either directly (requires installation so you can import it) or by calling style2style using subprocess for example.

Limitations

Because symbology formats are very different and the software they are intended for have different capabilities, not all symbology features can be converted between formats.

To find out what the exact limitations are, you will have to check the code... 😥

However, there is a document for QGIS that lists the QGIS symbology features that are (not) supported by the GeoStyler format. For more elaborate information, you can consult the GeoCat Bridge for QGIS documentation.

If you wish to convert ArcGIS Pro .lyrx files into SLD, you may want to read this document. There are also some notes on MapServer.

Installation

Since June 2025, bridgestyle is available on PyPI, which means you can install it using pip. In your active Python environment, run the following command:

pip install bridgestyle

However, if you wish to use the library in QGIS, we highly recommend installing the GeoCat Bridge for QGIS plugin instead, as it already includes bridgestyle and provides a style preview and other useful features.
The plugin is available in the QGIS plugin repository, and can be installed directly from the QGIS Plugin Manager.

Usage

Here is an example how to export the symbology of a selected QGIS layer into a zip file containing an SLD style file and all the icons files (SVG, PNG, etc.) used by the layer:

from bridgestyle.qgis import saveLayerStyleAsZippedSld
warnings = saveLayerStyleAsZippedSld(iface.activeLayer(), "/my/path/mystyle.zip")

The warnings variable will contain a list of strings with the issues found during the conversion.

Conversion can be performed outside QGIS, using the library as a standalone element. Each format has its own Python package, which contains two modules: togeostyler and fromgeostyler, each of them with a convert method to do the conversion work. It returns the converted style as a string, and a list of strings with issues found during the conversion (such as unsupported symbology elements that could not be correctly converted).

Here is an example how to convert a GeoStyler JSON file into an SLD file:

from bridgestyle import sld
input_file = "/my/path/input.geostyler"
output_file = "/my/path/output.sld"

# We load the GeoStyler code from the input file
with open(input_file) as f:
    geostyler = json.load(f)

'''
We pass it to the fromgeostyler.convert method from the sld package.
There is one such module and function for each supported format, which 
takes a Python object representing the GeoStyler JSON object and returns 
a string with the style in the destination format.
'''
converted, warnings, obj = sld.fromgeostyler.convert(geostyler)

# We save the resulting string in the destination file
with open(output_file) as f:
    f.write(f)

style2style

A basic command line tool (CLI) is also available. When the library is installed in your Python environment, you will have a style2style script available to be run in your console, with the following syntax:

style2style original_style_file.ext destination_style_file.ext

The file format is inferred from the file extension.

The example conversion shown above would be run with the console tool as follows:

style2style /my/path/input.geostyler /my/path/output.sld

Contributing

If you would like to contribute to bridgestyle in any way, please read the contributing guidelines.

Some of the things you can do to help are:

  • Fix bugs and issues
  • Add new features (e.g. support for new formats, or add bidirectional conversion)
  • Improve documentation
  • Add tests

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bridgestyle-0.1.9.tar.gz (188.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bridgestyle-0.1.9-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

Details for the file bridgestyle-0.1.9.tar.gz.

File metadata

  • Download URL: bridgestyle-0.1.9.tar.gz
  • Upload date:
  • Size: 188.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bridgestyle-0.1.9.tar.gz
Algorithm Hash digest
SHA256 02e6163861b87329c389c654631291df076bf6c739b09d8a81e41c268ab9b5e0
MD5 072e9b141dbdb26eb52c735b50dca1d2
BLAKE2b-256 f188ea44d89a349c80c6d3648b81a54096b242cebe45168a26bf6fc0b53cc661

See more details on using hashes here.

Provenance

The following attestation bundles were made for bridgestyle-0.1.9.tar.gz:

Publisher: release.yml on GeoCat/bridge-style

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bridgestyle-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: bridgestyle-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for bridgestyle-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 86bcee64077ec669a0ddca7b66d98c302d893f049dddb40e07bd8b826f05e348
MD5 ff4ec4f813251b33d6552389162c9527
BLAKE2b-256 49af3419d3995dcc55441464623d65a0edff06931dce1536c072e8b9dcd1c212

See more details on using hashes here.

Provenance

The following attestation bundles were made for bridgestyle-0.1.9-py3-none-any.whl:

Publisher: release.yml on GeoCat/bridge-style

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page