A Python ESRI lyr/style file converter/extracter/parser

north-road, updated 🕥 2023-03-21 03:13:20

SLYR Logo

SLYR (community edition)

A QGIS plugin for extraction, parsing, and conversion of ESRI .lyr, .mxd and .style files.

This repo contains the community, open-source version of SLYR, which lags in features and capabilities from the full SLYR version. Read more about the full version and how you can obtain it at https://north-road.com/slyr/.

Build Status

Status

  • This open-source version only supports ESRI .style database files, and vector .lyr files. See https://north-road.com/slyr/ for the version which supports direct MXD file conversion, and support for raster, TIN and point cloud LYR files, and the ArcGIS Pro stylx/lyrx file types.
  • Full support for converting vector layers, including all symbology, labeling, all renderer types (unique, class breaks, bivariate, etc) and other general layer properties like scale ranges, hotlinks, and much much more.
  • Near 100% pixel perfect support for converting all fill types, line types and marker symbol types (depending on QGIS version -- for best results always use the lastest QGIS version)
  • RGB colors can be parsed, within a maximum of 1 unit difference in either the R/G/B components.
  • 100% color match for other color types, including HSV, CMYK, Grayscale, etc
  • All color ramp types can be parsed

Tools

  • bin_dump.py Converts a binary .style database row blob into a symbol and dumps the symbol properties to the console
  • style_dump.py Dumps the complete contents of an ESRI .style database, printing symbol properties to the console
  • style_to_bin.py Exports the contents of an ESRI .style database to individual .bin binary files, each containing an encoded version of a single symbol
  • style_to_qgis_xml.py Converts the contents of an ESRI .style database to a QGIS 3.x Style .xml file, ready for importing direct into your QGIS style library (requires QGIS 3.x)

Style parsing tools require the command line mdbtools for handling the .style database files. Binaries of these can be downloaded from https://github.com/lsgunth/mdbtools-win, and they should be extracted and available in the Windows path. Alternatively, you can extract them to any folder and then setup the correct path to that folder through the Settings -> Options -> SLYR panel.

LYR parsing tools do not require any additional dependencies.

QGIS Plugin

SLYR also functions as a QGIS plugin (for QGIS >= 3.4). The community (unlicensed) version of the plugin is available via the standard QGIS plugins repository, so you can install it directly from within QGIS itself.

The plugin adds a new group to the Processing Toolbox for "SLYR", containing tools for conversion of style databases to QGIS symbol styles. Note that Windows users will first need to setup the path to the mdbtools binaries via Options - Processing - Providers - SLYR. There's also an algorithm for converting color palettes stored in style files to the standard GPL color palette text format.

The plugin throws warnings (and optionally creates a report) containing properties which cannot be translated to QGIS symbology. If you get these warnings, PLEASE consider sponsoring the feature development within QGIS itself! Everyone benefits, and you'll usually be pleasantly suprised at how inexpensive this can be! Just shoot us an email to [email protected] to discuss.

Specifications

Some description of the .style binary format can be found in specs.md, although the most up-to-date reference is the Python parsing code itself.

Hall of Fame

SLYR wouldn't be possible without direct financial support for its development. The following organisations have directly contributed to SLYR development, and are deserving of gratitude!

And hey, if you want to see slyr improved, why not consider financially supporting its development? Drop me a line at [email protected] to discuss.

Issues

I love your logo

opened on 2023-02-08 05:22:15 by akusok

Nothing to request, thanks for the logo :)

Unicode support(UTF-8)

opened on 2022-09-20 16:09:45 by otofoto

When converting style files the resulting xml loses non-latin characters.

Qgis 3.18.3 SLYR 4.0.6

OS: Windows 10 version 21H2 (English) Regional settings: Latvian System Locale: Latvian ("Beta: Use Unicode UTF-8 for worldwide language support" - disabled)

topo50.style.zip

slyr does not appear to work on mac OSX

opened on 2022-09-10 06:28:41 by nickskelton2

Current QGIS and Current OSX SLYR plugin is installed

QGIS version: 3.26.2-Buenos Aires QGIS code revision: b0f8302dbc Qt version: 5.15.2 Python version: 3.9.5 GDAL version: 3.3.2 GEOS version: 3.9.1-CAPI-1.14.2 PROJ version: Rel. 8.1.1, September 1st, 2021 PDAL version: 2.3.0 (git-version: Release) SLYR (community edition) version: 4.0.3 Algorithm started at: 2022-09-10T16:27:00 Algorithm 'Convert MXD/MXT to QGS' starting… Input parameters: { 'INPUT' : '/Users/Shared/GIS Best Files/Vegetation/SVTM extant and pre 1750/NSW C1.1 M1 Aug 22/vegetation_svtm_nsw_extant_pct_quickview/SVTM_NSW_Extant_PCT.mxd', 'OUTPUT' : 'TEMPORARY_OUTPUT' }

then nothing happens

same with .lyr

tried it on a few .lyr and mxb

Great work Thanks

Nick

can not use “convert ESRI style to QGIS stye XML"

opened on 2022-05-15 03:39:59 by smlie2020

When I double-click the tool,An error message appears Python error: An error has occurred while executing Python code: See message log (Python Error) for more details. ``` UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 58: illegal multibyte sequence Traceback (most recent call last): File "C:\PROGRA~1/QGIS32~1.6/apps/qgis-ltr/./python/plugins\processing\gui\ProcessingToolbox.py", line 241, in executeAlgorithm ok, message = alg.canExecute() File "C:\Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\slyr_community\qgis_plugin\algorithms\style_to_xml.py", line 108, in canExecute if not Extractor.is_mdb_tools_binary_available(): File "C:\Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\slyr_community\bintools\extractor.py", line 149, in is_mdb_tools_binary_available for line in proc.stdout: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 58: illegal multibyte sequence

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] QGIS version: 3.22.6-Białowieża Białowieża, b6f33b1a

Python Path: C:\Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\OpenTopography-DEM-Downloader C:/PROGRA~1/QGIS32~1.6/apps/qgis-ltr/./python C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS32~1.6/apps/qgis-ltr/./python/plugins C:\Program Files\QGIS 3.22.6\bin\python39.zip C:\PROGRA~1\QGIS32~1.6\apps\Python39\DLLs C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib C:\Program Files\QGIS 3.22.6\bin C:\PROGRA~1\QGIS32~1.6\apps\Python39 C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib\site-packages C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib\site-packages\GDAL-3.4.2-py3.9-win-amd64.egg C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib\site-packages\win32 C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib\site-packages\win32\lib C:\PROGRA~1\QGIS32~1.6\apps\Python39\lib\site-packages\Pythonwin C:/Users//AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users*\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\HCMGIS/forms C:\Users*\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\mmqgis/forms ```

UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 58: illegal multibyte sequence

opened on 2022-04-13 12:27:21 by Tonynovtop

Hello, I got an UnicodeDecodeError error when i use the 'Convert Esri style to QGIS style xml' of SLYR in QGIS. the detial information of error is: 2022-04-13T19:47:46 WARNING Traceback (most recent call last): File "D:\OSGeo4W/apps/qgis-ltr/./python/plugins\processing\gui\ProcessingToolbox.py", line 241, in executeAlgorithm ok, message = alg.canExecute() File "C:\Users/yiwuz/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\slyr_community\qgis_plugin\algorithms\style_to_gpl.py", line 81, in canExecute if not Extractor.is_mdb_tools_binary_available(): File "C:\Users/yiwuz/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\slyr_community\bintools\extractor.py", line 149, in is_mdb_tools_binary_available for line in proc.stdout: UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 58: illegal multibyte sequence

QGIS veriosn: 3.16.16 Python:3.9 Platform:windows 10 mdbtools:https://github.com/lsgunth/mdbtools-win SLYR: installed from QGIS plugin. I have set 'Settings -> Options -> SLYR -> set-MDB-tools-path'.

image

slyr cannot find mdb-export in path

opened on 2022-01-29 03:32:49 by skytwosea

Hello, I cannot get slyr to find the mdb-export binary. I get the following message:

This algorithm cannot be run :-( The MDB tools "mdb-export" utility is required to convert .style databases. Please setup a path to the MDB tools utility in the Settings - Options dialog, under the SLYR tab.

I have gone to Settings -> Options -> SLYR -> set-MDB-tools-path and have set it to /usr/bin

confirm that mdb-tools is on that path: ``` which mdb-export /usr/bin/mdb-export

find / -name "mdb-export" /usr/bin/mdb-export ```

platform specs: Kubuntu 20.04, kernel 5.4.0-96-generic on 64-bit Intel i7; QGIS 3.22.3 successfully downloaded slyr plugin to QGIS - slyr appears in processing tools installed mdb-tools via apt

I would greatly appreciate any help! I'm stumped

Releases

Version 2.0 2018-11-04 23:23:35

To install, download the zip release below, and then install via the Plugins -> Manage and Install Plugins > Install from ZIP tab.

Testing feedback is sought and very welcome -- just file issues on https://github.com/nyalldawson/slyr/issues with a detailed description of any issues you encounter.