30.3. Appendix C: QGIS File Formats
30.3.1. QGS/QGZ - The QGIS Project File Format
The QGS format is an XML format for storing QGIS projects. The QGZ format is a compressed (zip) archive containing a QGS file and a QGD file. The QGD file is the associated sqlite database of the qgis project that contain auxiliary data for the project. If there are no auxiliary data, the QGD file will be empty.
A QGIS file contains everything that is needed for storing a QGIS project, including:
the layer tree
the map canvas extent
mapview docks (2D and 3D)
the layers with links to the underlying datasets (data sources) and other layer properties including extent, SRS, joins, styles, renderer, blend mode, opacity and more.
The figures below show the top level tags in a QGS file and the expanded
30.3.2. QLR - The QGIS Layer Definition file
A Layer Definition file (QLR) is an XML file that contains a pointer to the layer data source in addition to QGIS style information for the layer.
The use case for this file is simple: To have a single file for opening a data source and bringing in all the related style information. QLR files also allow you to mask the underlying datasource in an easy to open file.
An example of QLR usage is for opening MS SQL layers. Rather than having to go to the MS SQL connection dialog, connect, select, load and finally style, you can simply add a .qlr file that points to the correct MS SQL layer with all the necessary style included.
In the future a .qlr file may hold a reference to more than one layer.
30.3.3. QML - The QGIS Style File Format
QML is an XML format for storing layer styling.
A QML file contains all the information QGIS can handle for the rendering of feature geometries including symbol definitions, sizes and rotations, labelling, opacity and blend mode and more.
The figure below shows the top level tags of a QML file (with
renderer_v2 and its
symbol tag expanded).