Skip to main content
Add how to do with 7zip
Source Link
Houska
  • 8.4k
  • 21
  • 51

QGIS .qgz files are merely zip containers which have the .qgs file embedded, together with potentially some sidecar files.

I have just tried, and on a simple project just zipping the .qgs file alone into a .qgz file generates a usable .qgz project. In recent versions of QGIS, it is missing the project styles database (ending in .db, see https://github.com/qgis/QGIS/commit/c6beb62216fcfbfe3ca64283c09117da53800a98 ) but no errors or warnings appear to be generated, so if you aren't using multiple project style databases functionality, you should be fine.

Assuming this is the case, just therefore use your favourite zip utility to zip up each .qgs file to a .qgz file, say using the command line.

For instance, if you have 7zip installed, the following CMD line will iterate and zip up all .qgs files in the current directory into .qgs files

for %a in (*.qgs) do "C:\Program Files\7-Zip\7z" a -tzip "%~na.qgz" "%a"

That's assuming the directory is right for 7z.exe. The for loop uses the variable %a to loop through all qgs files, invoking 7zip to make a ZIP (not 7Z) format archive (that's the a -tzip) of the corresponding .qgz file (%~na.qgz means the stripped filename of variable %a with .qgz added). You may need to modify this based on how/where the qgs files are, where 7zip is, and what other zip utility you may prefer.

QGIS .qgz files are merely zip containers which have the .qgs file embedded, together with potentially some sidecar files.

I have just tried, and on a simple project just zipping the .qgs file alone into a .qgz file generates a usable .qgz project. In recent versions of QGIS, it is missing the project styles database (ending in .db, see https://github.com/qgis/QGIS/commit/c6beb62216fcfbfe3ca64283c09117da53800a98 ) but no errors or warnings appear to be generated, so if you aren't using multiple project style databases functionality, you should be fine.

Assuming this is the case, just therefore use your favourite zip utility to zip up each .qgs file to a .qgz file, say using the command line.

QGIS .qgz files are merely zip containers which have the .qgs file embedded, together with potentially some sidecar files.

I have just tried, and on a simple project just zipping the .qgs file alone into a .qgz file generates a usable .qgz project. In recent versions of QGIS, it is missing the project styles database (ending in .db, see https://github.com/qgis/QGIS/commit/c6beb62216fcfbfe3ca64283c09117da53800a98 ) but no errors or warnings appear to be generated, so if you aren't using multiple project style databases functionality, you should be fine.

Assuming this is the case, just therefore use your favourite zip utility to zip up each .qgs file to a .qgz file, say using the command line.

For instance, if you have 7zip installed, the following CMD line will iterate and zip up all .qgs files in the current directory into .qgs files

for %a in (*.qgs) do "C:\Program Files\7-Zip\7z" a -tzip "%~na.qgz" "%a"

That's assuming the directory is right for 7z.exe. The for loop uses the variable %a to loop through all qgs files, invoking 7zip to make a ZIP (not 7Z) format archive (that's the a -tzip) of the corresponding .qgz file (%~na.qgz means the stripped filename of variable %a with .qgz added). You may need to modify this based on how/where the qgs files are, where 7zip is, and what other zip utility you may prefer.

Source Link
Houska
  • 8.4k
  • 21
  • 51

QGIS .qgz files are merely zip containers which have the .qgs file embedded, together with potentially some sidecar files.

I have just tried, and on a simple project just zipping the .qgs file alone into a .qgz file generates a usable .qgz project. In recent versions of QGIS, it is missing the project styles database (ending in .db, see https://github.com/qgis/QGIS/commit/c6beb62216fcfbfe3ca64283c09117da53800a98 ) but no errors or warnings appear to be generated, so if you aren't using multiple project style databases functionality, you should be fine.

Assuming this is the case, just therefore use your favourite zip utility to zip up each .qgs file to a .qgz file, say using the command line.