-
-
Notifications
You must be signed in to change notification settings - Fork 969
Update qgis_file_formats.rst #9598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
velle
wants to merge
7
commits into
qgis:master
Choose a base branch
from
velle:patch-2
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2d01a3d
Update qgis_file_formats.rst
velle 5fa6c96
Update docs/user_manual/appendices/qgis_file_formats.rst
velle 80cacf0
Update docs/user_manual/appendices/qgis_file_formats.rst
velle 83d4278
Update docs/user_manual/appendices/qgis_file_formats.rst
velle 7759fb1
Update docs/user_manual/appendices/qgis_file_formats.rst
velle cc5eb8c
Update docs/user_manual/appendices/qgis_file_formats.rst
velle d82f9a3
Update qgis_file_formats.rst
velle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,54 +10,68 @@ Appendix C: QGIS File Formats | |||||
| .. index:: QGD | ||||||
| .. _qgisprojectfile: | ||||||
|
|
||||||
| 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: | ||||||
|
|
||||||
| * project title | ||||||
| * project CRS | ||||||
| * the layer tree | ||||||
| * snapping settings | ||||||
| * relations | ||||||
| * the map canvas extent | ||||||
| * project models | ||||||
| * legend | ||||||
| * 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. | ||||||
| * project properties | ||||||
|
|
||||||
| The figures below show the top level tags in a QGS file and the expanded | ||||||
| ``ProjectLayers`` tag. | ||||||
|
|
||||||
| .. _figure_qgs_toplevel: | ||||||
|
|
||||||
| .. figure:: img/qgstoplevel.png | ||||||
| :align: center | ||||||
| .qgz or .qgs- The QGIS Project File Format | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| The top level tags in a QGS file | ||||||
| When you see a file with either .qgz or .qgs extension, those are QGIS project files. | ||||||
|
|
||||||
| .. _figure_qgs_projectlayers: | ||||||
| This file format does not itself contain any geodata, ie it does not contain aerial photos and it does not contain polygon or point features representing features on a map. It only contains data _about_ which layers to show and how to show them. | ||||||
|
|
||||||
| .. figure:: img/qgsprojectlayers.png | ||||||
| :align: center | ||||||
|
|
||||||
| The expanded top level ProjectLayers tag of a QGS file | ||||||
| When you edit the name of a mountain in the layer called mountains and click `Save Layers Edit`, then that change is saved to the layer source, which might be a local GeoJson file or a remote database. But nothing is changed to the qgis project file. | ||||||
|
|
||||||
| When you change QGIS to show labels with those mountain names in blue and with Comic Sans, and you click "Save Project", this data about presentation is saved to the project file. | ||||||
|
|
||||||
| Evolution from qgs to qgz | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| QGIS version 2 only knew of one project file format, which was XML with a .qgs extension. | ||||||
|
|
||||||
| But XML has its limitations and eventually it was necessary to also store project data in other ways than plain XML. | ||||||
|
|
||||||
| With the introduction of QGIS 3 the default fileformat was .qgz, which is a zip archive containing the .qgs file. But because it's a zip file, it can also contain other files, so called *sidecar files*. Currently there are two official types of sidecar files: | ||||||
velle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| - .qgd (see section below) | ||||||
| - XXXXXX_styles.db, (see section below) | ||||||
|
|
||||||
| Alternative: myproject.qgs with myproject_attachments.zip | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| It is however also possible to not use .qgz, and instead save a project to .qgs. If choosing so, any sidecar files will be saved to a separate zip file. E.g. when saving to myproject.qgs, the sidecar files will be written to the archive myproject_attachments.zip, placed in the same folder. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
?: |
||||||
|
|
||||||
| One reason for choosing to use .qgs instead of .qgz is | ||||||
| that its more suited for running diff tools, e.g. if one wants to run version control on qgis project files. | ||||||
velle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| .qgs - The QGIS Project XML Format | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| The .qgs is an XML format, which contains the most fundamental parts of the project. This includes: | ||||||
|
|
||||||
| - project title | ||||||
| - project CRS | ||||||
| - the layer tree | ||||||
| - snapping settings | ||||||
| - relations | ||||||
| - the map canvas extent | ||||||
| - project models | ||||||
| - legend | ||||||
| - 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. | ||||||
| - project properties | ||||||
|
|
||||||
| .qgd - Sidecar for storing auxiliary data | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| One example of auxiliary data is when the project file contains data about individual features from a layer, ie data that is associated with a feature, and thus not simply associated with a layer. One example is if the user specifies label placement for individual features. | ||||||
velle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| If saving a project to foo.qgz, and the project contains any auxiliary data, then that aux data will be saved to foo.qgd which is added to the archive. If no auxiliary data is present, then this sidecar file won't be created. The d is short for databse, and the file is an sqlite3 database. | ||||||
velle marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| XXXXXX_styles.db - Sidecar file for storing style information | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
| XXXXXX is a six character randomly generated string, so it could look like XiIaRN_styles.db or clnCHe_styles.db. | ||||||
|
|
||||||
| .. index:: QGIS Layer Definition File | ||||||
| .. index:: QLR | ||||||
| .. _qgislayerdefinitionfile: | ||||||
| Typically there is just one such sidecar file, but there might be more. They are sqlite3 databases and contain information relevant to layer styling. | ||||||
|
|
||||||
| QLR - The QGIS Layer Definition file | ||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||||||
|
|
||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.