QGIS Basic Skills | 19 Analysis of QGIS Engineering Documents

​ 01 Project File

 

The Project File uses XML files to store all the states of the current QGIS session (Session), including map-related layers, whether the layers can be queried, layer attributes (symbols and styles), the coordinate system of the map window, and the print layout ( Including the elements and their settings), digital settings, table associations, macro definitions, default styles, plug-in settings, etc. At present, the project file has covered 28 aspects of the QGIS conversation, and its content is still being expanded.

 

Project files can be used to conveniently store, reuse and share completed work results.

 

 02 Open, create and save projects

 

  • Open the project

 

Double-click the project file in the file explorer of the windows system to start the QGIS session with the file.

 

 

 

If QGIS has been started, you can locate the project file path in the [Browser] panel, double-click or directly drag the project file to the map window, you can also open the project file.

 

 

Click the [Open] button on the QGIS toolbar or the menu [Project] -> [Open], browse to the disk location of the project file, and select the project file to be opened. This is the third way to open the project file.

 

 

  • New Construction

 

Menu [Project] -> [New], or click the [New Project] button in the project toolbar, you can clear the current session content and open a brand new session. By default, QGIS uses "unnamed project" to name the new session.

 

 

 

When creating a new project, if the currently opened project has unsaved changes (the title bar shows *), QGIS will pop up a dialog box to prompt to save the content of the current project changes, click the [Save] button to save, and [Discard] to abandon the current changes. To modify the project file, create a new project directly, and [Cancel] will create a new project.

 

 

  • Save the project

 

When the map settings are completed, you can use the [Save Project] button on the toolbar, or the menu [Project] -> [Save]/[Save As] to save the current session state to disk.

 

 

If the project is saved for the first time, QGIS will prompt to choose the path to save and the name of the project file. The default extension is .QGZ, which is a compressed file. Corresponding to it is the .QGS extension, which is an uncompressed project file. At this time, the project file is stored in XML format and can be opened and edited with a text editor.

 

​ 

03 Analysis of Engineering Documents

 

  • Storage format

 

The project file can be saved as *.QGS or *.QGZ two suffix formats. *.QGS file format is a clear code file saved in XML format, while *.QGZ file is a zip compressed file, including a QGS file and a QGD file (QGD file is a database that stores auxiliary data associated with the project in SQLite format, If there is no auxiliary data, the QGD file is empty).

 

Modify the extension of the QGZ file to zip, and you can open it with decompression software to view its content.

 

 

The default storage format can be set in the menu [Settings] -> [Options] -> [General] -> [Default Project File Format].

 

  • Detailed explanation of project file content

 

Open the project file in QGS format with a text editor, you can see its root node and 28 first-level nodes as shown below:

 

 

The content of each node is described as follows:

 

  1. Qgis: The root node, the parent node of all project file elements, records the save time, project name, author, and QGIS version of the project file.

  2. homePath: Project home directory, set in [Project Properties] -> [General].

  3. Title: Project title, set in [Project Properties] -> [General].

  4. Autotransaction: automatically create a transaction. Transaction editing means that in the supported databases, the editing status from the same database is synchronized and executed in a server-side transaction. When enabled, layers originating from the same database connection will be grouped into the same transaction group. Their editing status will be automatically synchronized, and changes to these layers will be sent to the data source immediately. Currently only supports Postgre, GPKG, Spatialite and Oracle databases. Set it in [Project Properties] -> [Data Source].

  5. evaluateDefaultValues: Whether to evaluate the default value on the data source side. When digitizing a new element, whether to automatically calculate the default value of the field defined by the database. The default value will be assigned as soon as possible after it is enabled. Currently only supports Postgre, GPKG, Spatialite and Oracle databases. Set it in [Project Properties] -> [Data Source].

  6. Trust: Whether to trust the project without layer checking when the data source has no metadata. Speed ​​up the loading of the project by skipping the data check in the PostgreSQL layer. When the QGIS server environment or project contains huge database views or materialized views, not checking the layers will effectively improve the loading speed. Set it in [Project Properties] -> [Data Source].

  7. projectCrs: The definition of the project's coordinate reference system, which determines the coordinate reference system used by the map window.

  8. layer-tree-group: contains all the layer group definitions, composed of specific layers.

  9. snapping-settings: Snapping settings.

  10. Relations: Save the associated information of the layer or attribute table.

  11. Mapcanvas: Related attributes of the map canvas, such as name, visible range, coordinate reference system, map unit, etc. The map canvas is used to display layers and interact with the map. It is the most important user interface element in QGIS. A map window corresponds to a map canvas.

  12. projectModels: Geoprocessing models, saved in the project in XML format.

  13. Legend: Legend definition. Contains multiple legend layers, each layer legend stores its name, whether to display the number of features, drawing order, visibility, and whether to expand by default.

  14. mapViewDocks: Map windows other than the main map window.

  15. mapViewDocks3D: Three-dimensional map window.

  16. main-annotation-layer: Annotation layer. Each project contains an annotation layer, which is used to draw the added annotation, which is always on top of all layers and is always visible.

  17. Projectlayers: All layers referenced by the project are composed of multiple map layer (maplayer) child nodes. The element of each maplayer is the definition of the layer attribute, which is composed of the extent of the layer, the unique identifier of the layer (id), the data source associated with the layer (datasource), the keyword list (keywordList), and the layer name (layername). ), layer coordinate reference system (srs), metadata information (resourceMetadata), data source provider (provider), etc., actually store the settings in the layer properties dialog box in XML format.

  18. Layerorder: The rendering order of the layers. The elements are rendered from bottom to top, so the lower elements are drawn and rendered first.

  19. Properties: Project properties, including the default styles of the project (DefaultStyles), digitizing (Digitizing), default selected element color and map background color (Gui), etc. In fact, the options of the project properties dialog box are stored in XML format.

  20. dataDefinedServerProperties: Data definition server parameter properties.

  21. visibility-presets: The attributes of the map theme, including the name of the theme, the style used by each layer, whether it is visible, and whether it is expanded.

  22. transformContext: coordinate transformation settings.

  23. projectMetadata: This node records the metadata of the project.

  24. Annotations: Annotation collection. Each note generates a node, describing the content and style of the note.

  25. Layouts: Print layout node, composed of multiple layout (Layout) child nodes, each layout is for a layout window in the project.

  26. Bookmarks: Space bookmarks.

  27. ProjectViewSettings: Project pre-defined scale.  

  28. ProjectTimeSettings: Temporal settings of the project, including attributes such as start time, end time, time unit, and whether to open time accumulation.

  29. ProjectDisplaySettings: coordinate and orientation format settings, the corresponding properties can be viewed in "coordinate and orientation display" -> "azimuth format" under the [Project Properties] -> [General] tab.

 

Most of the first-level nodes of the project file contain one or more sub-nodes. For example, expand the Projectlayers node, and its child nodes are composed of the layer (maplayer) node referenced by the project, which describes the properties of the layer in detail, as shown in the following figure:

 

 

It can be seen that the project file contains the detailed content of the current QGIS session. If you are familiar with the content, you can modify the project file with a text editor instead of QGIS. The effect is the same as using the QGIS interface to modify the project file.

 


Copyright Notice

 

This article welcomes reprinting, please indicate the source when reprinting.

 

 

Guess you like

Origin blog.csdn.net/QGISClass/article/details/113030667