Set up a OGC WWS/WFS/WCS service.
Run the python QGIS server from https://github.com/3liz/py-qgis-server in a docker container.
Versions are published on Docker Hub https://hub.docker.com/r/3liz/qgis-map-server
To know the QGIS version used in an image:
docker run -it 3liz/qgis-map-server:3.10 version
will return the full QGIS version used.
docker run -p 8080:8080 [--user <uid>[:<gid>]] -v /path/to/qgis/projects:/qgis-data 3liz/qgis-map-server
docker run -p 8080:8080 \
-v /path/to/qgis/projects:/projects \
-e QGSRV_SERVER_WORKERS=2 \
-e QGSRV_LOGGING_LEVEL=DEBUG \
-e QGSRV_CACHE_ROOTDIR=/projects \
-e QGSRV_CACHE_SIZE=10 \
3liz/qgis-map-server
The OWS requests use the following format: /ows/?<ows_query_params>
Example:
http://myserver:8080/ows/?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetCapabilities
MAP arguments are treated as relative to the location given by QYWPS_CACHE_ROOTDIR
The server is configured via environment variables or configuration file as described here
By default, the server ren as user and group id 9001. The user id may be customized by setting
the QGSRV_USER
environment variable to the - numerical - user ID of your choice
- QGSRV_CACHE_ROOTDIR: Absolute path to the qgis projects root directory
- QGSRV_CACHE_SIZE: Qgis projects cache size
- QGSRV_LOGGING_LEVEL: Logging level (DEBUG,INFO)
- QGSRV_SERVER_WORKERS: Number of QGIS server instances
The cache hold projects, if the project timestamp change on disk then the project will be reloaded.
Xvfb display support can be activated with QGSRV_DISPLAY_XVFB=ON
which is the default behavior.
Plugins can be used from a host mounted volume; use the QGSRV_SERVER_PLUGINPATH
environment
variables to set the path inside the container.
You may pass QGIS server environment variables by defining them as docker environment variables.
Useful variables are:
QGIS_OPTIONS_PATH # Path to look for qgis settings ini file
QGIS_SERVER_PARALLEL_RENDERING # Enable/Disable QGIS_SERVER_PARALLEL_RENDERING (default to false)
QGIS_SERVER_MAX_THREADS # Max num rendering threads (per processes) - default unlimited
QGIS_SERVER_WMS_MAX_HEIGHT # Maximum height for a WMS request - default not set
QGIS_SERVER_WMS_MAX_WIDTH # Maximum width for a WMS request - default not set
In order to use the server with Lizmap, you must set the following configuration
in your lizmapConfig.ini.php
:
[services]
wmsServerURL="http://my.domain:<port>/ows/"
...
; Use relative path
relativeWMSPath=true
- GeoPackages is not multiprocessing friendly and are not working well with read-only volumes. Avoid them if you intend to use your data with read-only volumes.
- Qgis requires Qt5 minimum, there is known issues with too old kernel. As a matter of fact, you should use a kernel 4.19 or superior.