31.3. Appendix C: QGIS File Formats

31.3.1. QGS/QGZ - QGIS工程文件格式

QGS是一种用于保存QGIS工程的XML格式,QGZ是一种包含QGS文件和QGD文件的压缩格式(zip)文件,QGD是一个关联sqllite数据库的文件,里面包含了QGIS工程的辅助数据,如果一个工程没有辅助数据,QGD文件将会为空。

QGIS文件包含了任何存储QGIS工程需要的信息,包括

  • 工程标题

  • 工程参考坐标系

  • 图层树

  • 捕捉设置

  • 关系

  • 地图画布范围

  • 工程模型

  • 图例

  • 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 ProjectLayers tag.

../../../_images/qgstoplevel.png

图 31.1 The top level tags in a QGS file

../../../_images/qgsprojectlayers.png

图 31.2 The expanded top level ProjectLayers tag of a QGS file

31.3.2. QLR - QGIS 图层定义文件定义

图层定义文件(QLR)是一种包含图层数据源的指针和次图层的QGIS样式信息的XML文件

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.

未来,一个qlr文件将会支持引用多个图层

../../../_images/qlr.png

图 31.3 The top level tags of a QLR file

31.3.3. QML - QGIS样式文件格式

QML是一种用于存储图层样式的XML文件格式

QML文件包含了GIS能够处理的所有信息(用于渲染几何要素的信息),包括符号定义、尺寸、旋转、标注、不透明度、混合模式等

The figure below shows the top level tags of a QML file (with only renderer_v2 and its symbol tag expanded).

../../../_images/qml.png

图 31.4 The top level tags of a QML file (only the renderer_v2 tag with its symbol tag is expanded)