2. Configuration
The first program start of QGIS creates (if not available) a user profile in the user's home directory, by default in
%APPDATA%\QGIS\QGIS3
- The profile (
default
) contains subfolders for processing, color palettes, various (optional) templates, GUI adjustments, etc. as well as additional Python plugins and in particular - the settings file
QGIS3.ini
, which contains all QGIS program settings.
2.1 Standardization
- Since all program settings made in QGIS are saved in
QGIS3.ini
, a manually prepared and configured profile using QGIS can then be distributed as a (standard) copy (e.g. via a network drive, batch script).The initial settings are based on specifications that are programmed in the software code (visible under: Settings/Options…/Advanced). Individually adjusted values from
QGIS3.ini
override the default specifications.
By distributing a prepared user profile (lets call it
settings_template
), the entire standardized configuration is finally available as an independent copy on the workstation PCs — even in the case of network installation! — But keep in mind that:Users could change or delete (basic) settings
Correction and maintenance
of standard settings are therefore quite complex and possibly protracted (→ individually for each work station)
2.2 Important Settings
- Connections to common data sources (see menu: Layer/Data Source Manager), such as a central PostGIS database or OWS services from the (own) SDI, are usually essential for the organization-wide use of QGIS.
The connection details can be found in
QGIS3.ini
under the tag[PostgreSQL]
or[qgis]
(OWS)
- This often includes external extensions (plugins), including their environment-dependent configuration such as data source connections, for example:
- norGIS ALKIS-Einbindung — queryable vector layer map from a PostGIS database1) of German cadastre data (ALKIS)
- Discovery — customizable search function on local PostGIS databases
- QGIS Map Library — insert predefined topic layers into the QGIS project at the push of a button.
- Further QGIS configurations for the use of existing, organization-wide resources can include:
- Search path(s) for SVG symbols or additional print templates → on network drives
- User-defined environment variables — which are not required/used until the program has started, e.g.
PGSERVICEFILE
2) - special network settings and proxy for web access
- Search filter of the Locator Bar
- …everything else that should be standardized or optimized:
- Colors
- Layouts
Uniform use of specific data and common resources throughout the entire organization
Standardized and at the same time customizable working background and tools at every work station
3. Centralization
- There are various methods for centralizing the QGIS settings and options:
3.1 Start parameters
- Start parameters (command line options) that are called in connection with the QGIS start file. Of particular interest are:
--globalsettingsfile [path]
— Using this option, you can specify the path for a Global Settings file, by default%OSGEO4W_ROOT%/resources/qgis_global_settings.ini
.The settings in the specified file replace the original inline default ones, but the user profiles’ settings will be set on top of those!
Placing the
qgis_global_settings.ini
file on a network shared folder gives a system administrator the possibility to change global settings and defaults in several machines by only editing one file!- There is currently no way to specify the location of certain settings, so a (renamed) copy has to be made manually and supplemented with the corresponding values from QGIS3.ini.3)
Theoretically, you should be able to deliver a completely empty QGIS3.ini, which will later be automatically filled with individual settings.But Issue #29281 & #29226 require that the [locale]-setting must be included in
QGIS3.ini
![locale] userLocale=de_DE overrideFlag=false globalLocale=de_DE showGroupSeparator=false
As I learned, the Python class
QgsSettings
is required to use qgis_global_settings.ini and replacesQSettings
4). This code adjustment must also be followed in external plugins so that their settings are read from qgis_global_settings.ini, see Discovery #73 & Map Library #2.
--authdbdirectory [path]
— Defines, similar to globalsettingsfile, the path to the directory where the authentication database will be stored and loaded.--profiles-path [path]
— Specifies a path to load and save the profiles (user settings)This option allows you to, for instance, carry all your plugins and settings in a flash drive, or, for example, share the settings between different computers using a file sharing service.
--customizationfile [path]
— Defines a UI customization file (QGISCUSTOMIZATION3.ini
), that will be used at startup.--code [path]
— Path to a givenpython file that is run directly after QGIS has started.
3.2 Environment variables
- In some cases you can use an environment variable instead of the command line option.
It is crucial for the use of environment variables when they have to be available in order to fulfill their purpose!
QGIS_GLOBAL_SETTINGS_FILE
→ see above--globalsettingsfile
QGIS_CUSTOM_CONFIG_PATH
→ see above--profiles-path
These must be set in the (user profile of the) operating system [of the target computer] each time at startup/before QGIS is completely started to take effect. As QGIS system options (see above, standardization point 3. this cannot work!PYQGIS_STARTUP
— Points to a Python script that is executed before QGIS starts.
- Options for placing environment variables (on the target computer)
or moved to a separate file on a network drive
Variables set in this way are unloaded as soon as QGIS is terminated.- Or even during the local QGIS „installation“ using a
.reg
file5) on a network drive (manually set up & export in the Windows registry editor). Command
start /wait regedit -s "[network share\]qgis_userEnv.reg"
in customized QGIS start file. - [Or via Windows Group / System Policy, which may be installed by the IT department when setting up a Windows user profile. In this way, no modified QGIS start files would be necessary on the target computers, the environment variables are permanently available.]
3.3 Python scripts
- Python scripts — (I haven't used this method yet.)
- Each time QGIS is started, it searches the user directory
%AppData%\Roaming\QGIS\QGIS3
for a filestartup.py
and executes it —regardless of the profile used.
- With the environment variable
PYQGIS_STARTUP
, a Python script (e.g. startup.py) can be executed before the initialization of QGIS is completed. This can be used to copy centrally stored settings etc. to the workstation PCs (→ example).
3)
Since this is neither comfortable nor easy, I hope for the implementation of theQEP #124 "Setting Registry"