In our previous article, we discovered how the Layer Menu from Project plugin enables you to quickly add layers to a project in progress. Today, we’re extending this logic to build a modular, reusable and professional QGIS environment, whether you’re a freelancer, a trainer or a member of a GIS team.
The aim: to work faster and more rigorously, while facilitating transmission and collaboration.
The 4 basic bricks
Here are the native or complementary tools we will be combining:
Tool | Usage |
---|---|
QGIS favorites | Quick access to GIS folders and files |
QGIS project templates | Standardized starting point for new projects |
Layer Menu from Project | Dynamic import of layers or groups |
PyQGIS scripts | Automate recurring actions (loading, configuration) |
Organize your QGIS favorites
Favorites are visible in the QGIS browser (left panel). They allow you to:
- quickly access your data folders
- point to files or databases that are used regularly
- share a clear working tree with a team
Right-click on a folder > Add to favorites
Rename it for clarity (Municipal data, Base maps, etc.)
Favorites are saved in the QGIS user profile. To share them with others, you can export/import the configuration file.
Sharing QGIS favorites: where are they stored and how to share them
Favorites in QGIS (in the file explorer, left column) provide quick access to frequently used folders. They are specific to each user profile and stored locally on the computer.
Location of favorites
Favorites are saved in the user profile folder, in a text file named:
favorites.xml
Typical path:
- In Windows:
C:\Users\<NomUtilisateur>\AppData\Roaming\QGIS\QGIS3\profiles\default\favorites.xml
- In Linux:
~/.local/share/QGIS/QGIS3/profiles/default/favorites.xml
Sharing your favorites with other users
To share your favorites with others:
- Export the favorites.xml file
- Copy it to the other user’s QGIS profile folder (replacing the existing file or merging the paths)
- Restart QGIS for the favorites to be updated
Warning: this method replaces existing favorites. For a more refined approach (adding, not replacing), it is preferable to open the file in an editor and copy and paste the desired tags.
Going further: creating a custom QGIS profile for a reusable work environment
QGIS allows you to create multiple user profiles. Each profile contains an independent configuration:
- Favorites
- Installed extensions
- Custom styles
- Project templates
- Keyboard shortcuts
- Database connections
- Global variables
- Python scripts (macros, custom expressions, etc.)
This allows you to create a consistent and portable QGIS environment for a team, project, or specific task.
Create a new profile
- In QGIS, go to:
Settings menu > User Profiles > Manage Profiles - Click on “New Profile” and give it a descriptive name (e.g., waste_project, GIS_training, community_profile).
- QGIS will restart with a blank environment that you can customize as you wish.
Distribute a profile to other workstations
Once the profile has been configured:
- Close QGIS
- Copy the profile folder from:
Windows:
C:\Users\<UserName>\AppData\Roaming\QGIS\QGIS3\profiles\<profile_name>
Linux:
~/.local/share/QGIS/QGIS3/profiles/<profile_name> - Paste this folder into the equivalent directory on another computer.
- Restart QGIS and select this profile via Settings > User Profiles.
Tip: You can create a “base profile” containing favorites, extensions, styles, project templates, etc., and distribute it to an entire team or for training sessions.
2. Create QGIS project templates
A project template is a .qgz file that serves as the basis for any new project.
Steps:
- Create a project with:
- a base map
- empty groups named (Source Data, Results, Annotations)
- default symbology
- standard layouts (legend, scale, title, etc.)
- Save it in a dedicated folder (e.g., C:\QGIS\Templates)
- In QGIS, go to Preferences > Options > System
➤ Set this folder as the project template directory
Result: you can create new projects from this template via File > New from Template.
3. Combine with Layer Menu from Project
Then use Layer Menu from Project to enrich your model projects as needed:
- On-demand base data
- Business modules (cadastre, environment, tourism, etc.)
- Styles and external georeferenced layers
You can create multiple .qgz sources, each corresponding to a theme or dataset, and make them accessible in all projects.
4. Add automation with PyQGIS
To go even further, you can automate certain tasks:
Examples:
# Automatically add a group and load a PostGIS layer
layer = QgsVectorLayer(“dbname=‘sig’ table=‘zones_inondables’”, “Flood zones”, “postgres”)
if layer.isValid():
QgsProject.instance().addMapLayer(layer, False)
root = QgsProject.instance().layerTreeRoot()
group = root.addGroup(“Risk”)
group.insertChildNode(0, QgsLayerTreeLayer(layer))
- Automatically load layers at startup
- Apply symbology
- Fill fields by expression
- Generate a custom PDF layout
You can also trigger these scripts when opening a project via the project properties > Python Actions.
Summary: your modular QGIS toolbox
Element | Role | Reusable? | Shareable? |
---|---|---|---|
QGIS favorites | Quick access to folders | ✅ | ⚠️manually |
Model project | Consistent starting point | ✅ | ✅ |
Plugin Layer Menu | Ready-to-use layer modules | ✅ | ✅ |
PyQGIS | Automated tasks | ✅ | ✅ |
To go further…
- Create a shared team environment (with Dropbox, Nextcloud, or Git) containing:
- A Models_QGIS/ folder
- A Projects_source/ folder for Layer Menu
- A Scripts/ folder
- Integrate your projects into a version control system to track changes
Tracking changes: integrating your QGIS projects into a version control system
When working on a QGIS project with others, or when you want to keep a clear history of changes, using a version control system such as Git becomes a real asset.
Why version your QGIS projects?
A .qgz or .qgs file contains:
- the layer structure
- styles
- filters and SQL queries
- layouts
- dynamic expressions
- links to data
All this information is stored as text (XML) in the .qgs file contained in a .qgz file. This means that Git can:
- detect changes line by line
- keep a history of changes
- allow you to revert to a previous version
- facilitate collaborative work by merging contributions from multiple users
Practical recommendations
- Work with .qgs files rather than .qgz files, so that you can read and version the file directly (.qgz is a compressed archive). Project menu > Project properties > General: check “Save as .qgs file instead of .qgz.”
- Organize your working directory with a clear structure:
/projet_qgis/
├── data/ # données (idéalement stables ou en lecture seule)
├── styles/ # SVG, palettes, ressources graphiques
├── projets/
│ └── carte_dechets.qgs
└── docs/ # documents, rapports, notes
- Initialize a Git repository at the root of the project:
git init
git add projets/carte_dechets.qgs
git commit -m "Version initiale du projet QGIS"
- Commit regularly after each significant change (adding a layer, new layout, style change, etc.).
Collaborative best practices
- Work on branches to test alternatives or thematic versions of the map.
- Use clear commit comments: “Added A3 layout with dynamic legend,” “Changed plastic waste style.”
- Synchronize your repository via GitHub, GitLab, Bitbucket, or an internal server if the project is confidential.
Limitations and precautions
- Do not version large binary files (e.g., geopackages, rasters, MBTiles): store them elsewhere or in a separate data repository.
- Do not edit a .qgs project simultaneously with others without coordination: Git does not always handle complex XML conflicts well.
Tip: You can combine Git and a QGIS project template to quickly deploy a standardized configuration while maintaining complete traceability of changes.
Example of a versioned structure
To facilitate collaboration and ensure reproducibility, it is useful to structure your QGIS projects in a tree structure suitable for versioning. Here is an example of an organization that you can reuse:
- projects/: QGIS .qgz or .qgs files (main version, variants)
- styles/: QML files defining map styles
- sample_data/: sample or test dataset
- scripts/: Python or bash automation scripts (imports, processing)
- docs/: user or technical documentation (e.g., getting started guide)
qgis-modele-projet/
│
├── projets/ ← Projets QGIS (.qgs lisible dans Git)
│ └── base_modele.qgs ← Projet modèle de départ
│
├── styles/ ← SVG, palettes, styles SLD ou QML
│ └── plages_dechets.qml
│
├── sample_data/ ← Jeu de données léger pour test/démo
│ └── plages_sample.gpkg
│
├── scripts/ ← Scripts Python QGIS ou Shell
│ └── init_qgis_env.py
│
├── docs/ ← Documentation utilisateur ou interne
│ └── guide_utilisation.md
│
├── .gitignore ← Fichier d’exclusion (fourni ci-dessous)
├── README.md ← Présentation du projet (à personnaliser)
└── LICENSE ← Licence libre (MIT, CC, etc.)
A .gitignore file allows you to exclude temporary files or files specific to each machine.
# Données volumineuses ou brutes (déplacées dans sample_data si besoin)
data/
*.gpkg
*.tif
*.csv
*.mbtiles
*.zip
# Fichiers temporaires ou système
*.qgz
*.aux.xml
*.lock
*.bak
*.tmp
*.DS_Store
Thumbs.db
# Layouts ou rendus
*.pdf
*.svg
*.png
*.jpg
# Caches et environnements virtuels
.qgis2/
.qgis3/
__pycache__/
venv/
# Logs et sauvegardes
*.log
*autosave*
You can initialize a local Git repository, or host this template on a platform such as GitHub, GitLab, or Bitbucket to share it with your team.
Download a ready-to-use example:
Next article
We will see how to prepare and share a complete portable QGIS environment:
data, styles, templates, and scripts on a USB stick or in a synchronized directory, so you can work or train independently, even without an internet connection.