Especially in larger organizations with numerous QGIS workstations the dynamic development of , which constantly brings improvements and great new functions, quickly gives rise to the desire for a centralized and simple distribution of the software as well as organization-specific default settings.
QGIS (LTR) centralized
Inspired by some previous instructions1) I want to describe my current (> = QGIS 3.10) solution for this task on Windows operating systems. The task comprises two goals, namely the uniform distribution of the QGIS (LTR) software on the one hand and the centralized provision of standardized configurations on the other. There are different approaches for each part, which can be combined depending on the application and needs. — T. Schüttenberg, Stadt Minden (Geoservice)
1. Download & (basic) Installation
- The OSGeo4W installer is used for the installation . — The following referes to the 64bit-version of QGIS (→ download osgeo4w-setup-x86_64.exe).
- Tip: This can also be operated using Commandline Options2)! This gives you the option, for example, of separating the package download and installation (for example for differently authorized users) and possibly automating these steps. - Example:
osgeo4w-setup-x86_64.exe -q -A -R T:\GISrepo\osgeo4w -D -l T:\GISrepo\osgeo4w -s http://www.norbit.de/osgeo4w/ -a x86_64 -g -k -P qgis-ltr-full -o -A --advanced Advanced install (as opposed to Express) -R --root Root installation directory [last osgeo4w settings here! \etc\setup\setup.rc] -D --download Download from internet [only] -l --local-package-dir Local package directory -s --site Download site -g --upgrade-also also upgrade installed packages -P --packages Specify packages to install [download]
- The installation basically consists of3)
- Download the selected program packages (including the resolution of all dependencies) into a local (temporary) directory,
- (MD5 check and) unzip into the defined
root
-directory ( →%OSGEO4W_ROOT%
) as well - Post-install routines in which, for example, path variables are adapted to the installation directory (→
\bin\qgis-ltr-bin-g7.env
,qgis-ltr-bin.env
), the Micrsoft Visual C ++ runtimes are installed and program start links are created.
- The registration of QGIS file extensions including the start command for project files as well as the installation of the Micrsoft Visual C ++ Runtime Redistributables require admin rights! 4)
- The DLL files of the various Micrsoft Visual C ++ Runtime versions are saved or updated in the
%SYSTEM%
directory5) (on the installation machine ), which prevents direct portability.- In order to prevent startup errors due to non-existing DLL files in the target system (see below), at least for QGIS 3.10 AFAIK the following DLLs have to be completed in the
\bin
directory of the installation:msvcp120.dll
,msvcr120.dll
,vcruntime140.dll
,vcomp140.dll
,opencl.dll
. (unfortulately not 100% predictable!) - Infos: Wiki Dll; QGIS Issue #30754
1.1 Network installation
- If the chosen installation directory is a shared network drive, QGIS can be started directly from here and used on the local PC, since no QGIS settings exist, for example, in the Windows registry or anywhere else.
Installation from local package directory using OSGeo4W Commandline:osgeo4w-setup-x86_64.exe -q -A -R V:\gisdept\qgisltrZentral -L -l T:\GISrepo\osgeo4w -a x86_64 -g -k -P qgis-ltr-full
- To start the network installation, users only need a local link to
[network share]\qgisltrZentral\bin\qgis-ltr-grass7.bat
.
1.2 Distribute the installation directory
- This installation directory can also simply be copied to another (workstation) PC (batch script, #2) in order to then run QGIS locally there.
- The disadvantage of local copies in the workplace, however, is that they are difficult to update evenly with a „pull“ method (like this one).
- The paths in
\bin\qgis-ltr-bin-g7.env
&\qgis-ltr-bin.env
must then be adapted to the new, local installation location (OSGEO4W_ROOT
). This is done by running the postinstall routines again (see script, #3)6):"%OSGEO4W_ROOT%\bin\qgis-ltr-grass7.bat" --postinstall "%OSGEO4W_ROOT%\bin\qgis-ltr.bat" --postinstall
- In connection with the copying process, program start links for the users should also be created on the target PC.
- Consistent (approved) QGIS version available at all workstations at any time, as a local copy or via network share
- No administrative privileges required for the use of QGIS
- Usage of common data and resources not yet predefined (→ next paragraph)
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 database7) 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
8) - 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.9)
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
10). 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
file11) on a network drive ( manually set up & export in the Windows registry editor). Commandstart /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.4 My Approach
- Relocation of standardized settings from (local)
QGIS3.ini
to centralqgis_global_settings.ini
, stored on a network drive. - Environment variables enable the maintenance of the QGIS setting options for all workplaces:
- Centrally stored file with commands for setting the environment variables
QGIS_CUSTOM_CONFIG_PATH
&QGIS_GLOBAL_SETTINGS_FILE
- Reading documentation and issue comments really helps, even if you're not a software engineer! ⇒ CHEERS for the QGIS community!!