QGIS (LTR) centralized

  • :i: 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).
    • :i: 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:
    1. :-/ Users could change or delete (basic) settings
    2. :-\ Correction and maintenanceFIXME of standard settings are therefore quite complex and possibly protracted (→ individually for each work station)

2.2 Important Settings

  1. 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.
    • :i: The connection details can be found in QGIS3.ini under the tag [PostgreSQL] or [qgis] (OWS)
  2. 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.
  3. 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. PGSERVICEFILE2)
    • special network settings and proxy for web access
    • Search filter of the Locator Bar
    • …everything else that should be standardized or optimized:
  • 8-) Uniform use of specific data and common resources throughout the entire organization
  • 8-) Standardized and at the same time customizable working background and tools at every work station
  • 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.
      • :i: The settings in the specified file replace the original inline default ones, but the user profiles’ settings will be set on top of those!
      • 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.
        1. :!: But Issue #29281 & #29226 require that the [locale]-setting must be included in QGIS3.ini!
        2. :t: As I learned, the Python class QgsSettings is required to use qgis_global_settings.ini and replaces QSettings4). 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. 8-) :-D
    • --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)
      • :t: 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.
    1. :t: 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.
    2. Options for placing environment variables (on the target computer)
      • Distribution & update using SET commands to be added to the .batfiles, like the QGIS start file
      • :t: 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 (:t: 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.)
    1. Each time QGIS is started, it searches the user directory %AppData%\Roaming\QGIS\QGIS3 for a file startup.py and executes it — :i: regardless of the profile used.
    2. 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).