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)

original german text!

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).
    • :t: 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]
  • :i: The installation basically consists of3)
    1. Download the selected program packages (including the resolution of all dependencies) into a local (temporary) directory,
    2. (MD5 check and) unzip into the defined root-directory ( → %OSGEO4W_ROOT%) as well
    3. 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!)

1.1 Network installation

  • :t: 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. 8-)
    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
  • :t: In connection with the copying process, program start links for the users should also be created on the target PC.
  • 8-) Consistent (approved) QGIS version available at all workstations at any time, as a local copy or via network share
  • 8-) No administrative privileges required for the use of QGIS
  • tbd Usage of common data and resources not yet predefined (→ next paragraph)

2. Configuration

  • :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 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.
  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. PGSERVICEFILE8)
    • 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

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.
      • :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.9)
        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!
          [locale]
          userLocale=de_DE
          overrideFlag=false
          globalLocale=de_DE
          showGroupSeparator=false
        2. :t: As I learned, the Python class QgsSettings is required to use qgis_global_settings.ini and replaces QSettings10). 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 file11) 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).

3.4 My Approach

  1. 8-) Relocation of standardized settings from (local) QGIS3.ini to central qgis_global_settings.ini, stored on a network drive.
  2. 8-) Environment variables enable the maintenance of the QGIS setting options for all workplaces:
    1. Centrally stored file with commands for setting the environment variables QGIS_CUSTOM_CONFIG_PATH & QGIS_GLOBAL_SETTINGS_FILE
    2. is called from the QGIS start file (bin\qgis-ltr-grass7.bat resp. bin\qgis-ltr.bat).
  3. :-D Reading documentation and issue comments really helps, even if you're not a software engineer! ⇒ CHEERS for the QGIS community!!
, 2020-10-15 12:40

Boris https://ya.ru

Geben Sie Ihren Kommentar ein. Wiki-Syntax ist zugelassen:
Wenn Sie die Buchstaben auf dem Bild nicht lesen können, laden Sie diese .wav Datei herunter, um sie vorgelesen zu bekommen.