The QLR Browser Plugin
Learn what this plugin does and how to use it
The QLR-Browser is probably the most interesting and useful Septima plugin for international QGIS users. In this blog I explain what a QLR file is, and how the plugin works.
This QLR Browser plugin allows you to maintain a central library of organizational GIS layers, including their symbology definitions. The data are easily accessible via a panel for all the QGIS users. This solution is very simple for a GIS manager to maintain and organize. Additionally, this plugin is available in English, German and Danish!
As a refresher, QGIS QLR files, also known as Layer Definition Files, save both layer source information and symbology. They differ from QML files, which store only symbology. They have been around for quite a while, since about 2015. An Esri user could think of them as being equivalent to ArcGIS LYR files.
You can create a QLR file from any QGIS supported data source: vector, raster, mesh, point cloud etc. The data source can be a flat file, a database connection, or a web service. A QLR file can also point to several layers in a layer group. For example, a single QLR file could be used to point to all the symbolized Natural Earth data layers. They also honor any filters applied to a layer.
The use case is simple, use a single file to add a data source to QGIS, while bringing in all the related styling information. This can be very useful for an organization, providing a centralized set of symbolized layers to work from.
QLR files are easy to create. From the QGIS Layers panel right-click on any layer or layer group and choose Export → Save as Layer Definition File…
You can find the plugin from the QGIS Plugin Manager by searching for QLR. The plugin provides a panel for managing QLR files.
Configuring the QLR Browser
Once installed, configuring the plugin is quick and easy. Open Settings → Options. Here you will see a QlrBrowser tab where you can set the Base directory for your QLR files. The plugin will search for QLR files in this base directory, including any sub-folders. The QLR panel will show a layer tree, nested according to the file location in the folder/subfolders.
If you want to further organize your QLR files you can include a numeric prefix. This allows you to control the ordering of the layers from 1 to x. Checking the Hide numeric prefixes in the file names box will strip the ordering prefixes off the layer names in the QLR Browser panel. The resulting layer list will be in ascending order as you specified. You should format these like 01~xxx.qlr.
With the QLR Browser configured, you can open the QLR Browser panel and dock it where you wish. Below the panel is docked to the right side of the QGIS map canvas. In the following example, I have some open data from Open Data DC covering Washington D.C. Some of these layers are local files and some are based on ArcGIS Feature Services. I can begin exploring the available QLR layers and simply toggle their visibility from the QLR Browser panel. Notice that the QLR Browser panel and the Layers panel are synchronized.
QLR Browser Search function
The QLR Browser also has search functionality. The search feature lets you search for QLR file names, and the names of the layers included in the qlr file. This search feature also works on some metadata fields in the QLR file.
Ordering QLR Files
To demonstrate the ordering of QLR files by numbering, a second set of the same QLR files have been created. Below the transportation QLRs are numbered 1-x, followed by a tilde.
When the QLR Browser is pointed to this ordered directory, you see that the numbers are stripped off, but serve to order the layers. The original folder is to the left and the ordered folder to the right.
For anyone needing a centralized set of styled and organized GIS layers, QLR files along with the QLR Browser could be a great solution!