3Liz

Open your GIS

QGIS-Plugin-Manager

Wed 12 January 2022

fr, en

QGIS Server plugins and how to manage them all

QGIS plugins

What would be QGIS without plugins ? It might be the first thing we do when we install QGIS on a new computer. We open the QGIS plugin manager, and we install our favorite plugins.

QGIS Desktop is providing a nice interface to manage plugins. You can easily list, install or upgrade them.

Quick important tip, in your plugin manager, in the Settings tab, do not forget to enable the Check for updates on startup at least every month. QGIS Plugin developers are releasing new versions of their plugins very often, it would be sad to miss new features or to keep having the same bug while it's already fixed !

QGIS Plugin manager in desktop

QGIS Server plugins

Maybe you don't know, but you can install plugins on QGIS Server. You can find the list of plugins compatible for QGIS Server on plugins.qgis.org. Plugins on QGIS Server can be useful to add new features or to alter the default behavior of QGIS Server. Let's have a look to a specific plugin below.

A use case, the WfsOutputExtension plugin

WFS is a standard made by the Open Geospatial Consortium to allow users to download vector data from QGIS Server in a OGC client such as QGIS Desktop, ArcGIS or any Web-GIS application (let's say randomly Lizmap Web Client). By default, this standard allows only the data to be downloaded as GML format. However, our customers wanted to download vector format with a more friendly vector format such as zipped shapefile, geopackage, ODS or CSV. Therefore, at 3Liz, we have developed the WfsOutputExtension server plugin.

This plugin adds additional export formats on the fly. In the background, the plugin intercepts the WFS GetCapabilities request and adds additional formats in the XML response. From the OGC client side, the user can use these formats when requesting vector data. It's visible from Lizmap Web Client in the dropdown menu:

WfsOutputExtension in action

QGIS-Plugin-Manager

As I mentioned, QGIS Desktop provides a nice way to manage plugins which are listed on the main QGIS repository. But when you are on a server, there isn't such tool to install and upgrade plugins. At 3Liz, we are managing our own server infrastructure. Deploying and upgrading plugins is done using some deployments tools such as Ansible.

We also deploy QGIS Server and Lizmap Web Client on our customers servers, outside of our hosting infrastructure. It means they host their own server and they ask us to do some maintenance on it. In this context, we previously installed QGIS Server plugins manually with the help of some wget and unzip commands. Not very convenient in the long term…

Therefore, I started a small Command Line Interface with Python to list and upgrade plugins when you are on a headless environment.

This tool can be installed with PIP on a server:

pip3 install qgis-plugin-manager

Then, you can list and install plugins from the bash prompt:

$ qgis-plugin-manager list
QGIS server version 3.19.0
List all plugins in /home/etienne/dev/qgis/server_plugin

----------------------------------------------------------------------------------------
|  Name            |  Version  |  QGIS min  |  QGIS max  |  Author         |  Action ⚠       |
----------------------------------------------------------------------------------------
|Lizmap            |master     |3.4         |3.99        |3Liz             |Unkown version   |
|wfsOutputExtension|1.5.3      |3.0         |            |3Liz             |                 |
|QuickOSM          |1.14.0     |3.4         |3.99        |Etienne Trimaille|Upgrade to 1.16.0|
|cadastre          |1.6.2      |3.0         |3.99        |3liz             |                 |
|atlasprint        |3.2.2      |3.10        |            |3Liz             |                 |
----------------------------------------------------------------------------------------

In the background, this tool is using ideas from APT and PIP. It's connected to the main QGIS plugin repository, but you can also add our own plugin repository like https://docs.3liz.org/plugins.xml

I suggest you to read the full documentation in the readme file. This project is hosted on GitHub so feel free to raise issues and even better, to make some pull requests 😉