6. Working with Project Files

6.1. Introducing QGIS projects

The state of your QGIS session is called a project. QGIS works on one project at a time. A settings can be project-specific or an application-wide default for new projects (see section Options). QGIS can save the state of your workspace into a QGIS project file using the menu options Project ▶ fileSave Save or Project ▶ fileSaveAs Save As….

Muista

If the project has been modified the * symbol will appear in the title bar and QGIS will, by default, ask you if you would like to save the changes. This behavior is controlled by the checkbox Prompt to save project and data source changes when required setting under Settings ▶ Options ▶ General.

You can load existing projects into QGIS from the Browser panel or by through Project ▶ fileOpen Open…, Project ▶ New from template or Project ▶ Open Recent ▶.

At startup, a list of Project Templates and Recent Projects are displayed, including screenshots, names and file paths (for up to ten projects). The Recent Projects list is handy to access recently used projects. Double-click an entry to open the project or project template. You can also add a layer to create a new project automatically. The lists will then disappear, giving way to the map canvas.

If you want to clear your session and start fresh, go to Project ▶ fileNew New. This will prompt you to save the existing project if changes have been made since it was opened or last saved.

When you open a fresh project, the title bar will show Untitled Project until you save it.

../../../_images/new_project.png

Fig. 6.1 Starting a new project in QGIS

The information saved in a project file includes:

  • Layers added

  • Which layers can be queried

  • Layer properties, including symbolization and styles

  • Projection for the map view

  • Last viewed extent

  • Print layouts

  • Print layout elements with settings

  • Print layout atlas settings

  • Digitizing settings

  • Table Relations

  • Project Macros

  • Project default styles

  • Plugins settings

  • QGIS Server settings from the OWS settings tab in the Project properties

  • Queries stored in the DB Manager

The project file is saved in XML format (see QGS/QGZ - The QGIS Project File Format). This means that it is possible to edit the file outside of QGIS if you know what you are doing. The project file format has been updated several times. Project files from older QGIS versions may not work properly any more.

Muista

By default, QGIS will warn you of version differences. This behavior is controlled in the General tab of Settings ▶ Options (checkbox Warn when opening a project file saved with an older version of QGIS).

Whenever you save a .qgs project file in QGIS, a backup of the file is created in the same directory as the project file, with the extension .qgs~.

The extension for QGIS projects is .qgs but when saving from QGIS, the default is to save using a compressed format with the .qgz extension. The .qgs file is embedded in the .qgz file (a zip archive), together with its associated sqlite database (.qgd) for auxiliary data. You can get to these files by unzipping the .qgz file.

Muista

The Auxiliary Storage Properties mechanism makes a zipped project particularly useful, since it embeds auxiliary data.

Projects can also be saved/loaded to/from a PostgreSQL database using the following Project menu items:

  • Project ▶ Open from

  • Project ▶ Save to

Both menu items have a sub-menu with a list of extra project storage implementations (PostgreSQL and GeoPackage). Clicking the action will open a dialog to pick a GeoPackage connection and project or a PostgreSQL connection, schema and project.

Projects stored in Geopackage or PostgreSQL can be also be loaded through the QGIS browser panel, either by double-clicking them or by dragging them to the map canvas.

6.2. Generating output

There are several ways to generate output from your QGIS session. We have already discussed saving as a project file in Introducing QGIS projects. Other ways to produce output files are:

  • Creating images: Project ▶ Import/Export ▶ saveMapAsImage Export Map to Image… outputs the map canvas rendering to an image format (PNG, JPG, TIFF…) at custom scale, resolution, size, … Georeferencing the image is possible. See Exporting the map view for more details.

  • Exporting to PDF files: Project ▶ Import/Export ▶ Export Map to PDF… outputs the map canvas rendering to PDF at custom scale, resolution, and with some advanced settings (simplification, georeferencing, …). See Exporting the map view for more details.

  • Exporting to DXF files: Project ▶ Import/Export ▶ Export Project to DXF… opens a dialog where you can define the ’Symbology mode’, the ’Symbology scale’ and vector layers you want to export to DXF. Through the ’Symbology mode’, symbols from the original QGIS Symbology can be exported with high fidelity (see section Creating new DXF files).

  • Designing maps: Project ▶ newLayout New Print Layout… opens a dialog where you can layout and print the current map canvas (see section Laying out the maps).