In this blog I will explain what a QLR is and why they are so versatile.
QGIS uses data layers (.shp, GeoPackage, Postgres, SQL etc.) and projects/workspaces (a way of managing a number of layers, styles, views, reports etc.).
Projects/workspaces are fantastic as they are generally a great way of organising project work for individual clients, particular site information or carrying out specific repeated outputs however, you may find yourself having a specific set of data layers that you always put together in a group in the layers panel and have to recreate these for every project – time consuming especially if the indivdual layers within a group have to be opened from different folders, databases, network locations etc.
The other issue is that you can only have a single instance of a project open in QGIS at any one time so it can be difficult to remember what layers go into a group, you could have multiple instances of QGIS open and flick between them looking at the groups in one whilst recreating that group in another project – pain in the a*** but it’s one way of doing it.
The QLR file.
The QLR file is basically a script which details groups, layers and styles. You can add layers to it, style those individual layers differently from their default without affecting that default, have sub-groups etc. all in one small QLR file. Sounds like a project? No, a QLR is different in that it can be added to any existing or new project, like you do a layer and it will open all the layers, with the styles you specified and any sub-grouping you specified at the time you created it. As it’s a small text file you could have a whole library of them specific to a purpose or project or a set of styles that conform to a particular standard etc. – whatever you like. As they are small files, you have no worries about storage size. If you are a data manager, you can even use them for consistant views across all your QGIS users.
Creating a QLR file.
A note before you start creating a QLR: you must have one or more layers within a group in the layer panel.
Simply add layers to your group – call the group/s anything you want, change layer styles, zoom levels, labelling, all the things that show that/those layers as you want them to appear.
Save the QLR by right clicking on the top group name, Export>Save As Layer Definition File, select where you want the file to be saved and there you are!
Note: if you wish to remove or add layers or change the existing style to an existing QLR, you will have to “export” (as explained above) and overwrite the existing QLR.
Suggestions:
Create a library for your QLR’s so you know where to find them
Give the QLR a descriptive name so you know what it is.
Resources:
Here is a QLR file that will add all NLS County 1914 25 inch historic maps to your project. These data x,y,z files are made available by NLS for use in GIS.
https://drive.google.com/file/d/1q1t9DVo4bQj5Jgz1oBjEodsJUmpE_gkk/view?usp=sharing































