-
-
Notifications
You must be signed in to change notification settings - Fork 153
Description
What is the bug? (in English)
When using the “Form filter” tool in Lizmap Web Client (v3.9.3) on a GeoPackage layer, the filter itself works and correctly filters the features on the map.
However, Lizmap repeatedly writes errors in the server log related to the SQL function GeomFromGPB.
The issue seems to be caused by Lizmap trying to compute the spatial extent (BBOX) of the filtered features through a direct SQLite query.
Because the SQLite engine used by Jelix/PHP does not include the QGIS-specific function GeomFromGPB, the query fails, and Lizmap logs multiple PHP notices and SQL errors.
The filter widget remains functional, but the logs are flooded with errors. The problem only occurs with GeoPackage (OGR provider) layers. With PostGIS layers, the filter runs without any error, since QGIS Server executes the spatial query correctly.
The root cause is that Jelix/PHP tries to compute a BBOX using:
SELECT AsGeoJSON(Extent(Transform(GeomFromGPB("geom"), 2056)), 8, 1)
but the GeomFromGPB() function is only available inside QGIS or GDAL, not in plain SQLite. The issue is harmless functionally, but pollutes the logs and may hide other errors.
[EDIT] The following PHP warnings often appear together with the GeomFromGPB error:
Undefined array key "authcfg" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
Undefined array key "schema" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
Undefined array key "tablename" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
These notices are side effects of the same problem.
They occur because Lizmap’s PHP code (qgisVectorLayerDatasource.class.php) expects connection parameters that exist for PostGIS layers (authcfg, schema, tablename), but not for OGR/GeoPackage layers.
Since a GeoPackage layer is a simple file path and not a database connection, these variables are undefined. The code then falls back to a direct SQLite query using the OGR provider.
The issue is not related to the PHP SpatiaLite extension. SpatiaLite is already installed and correctly enabled on this server. However, the failing function GeomFromGPB() is not part of SpatiaLite. It is a QGIS-specific internal function used by QGIS Server and GDAL to decode the GeoPackage Binary (GPB) geometry format.
When Lizmap executes the BBOX computation directly through its internal SQLite connection (via Jelix), it does not use QGIS Server nor GDAL — only the bare PHP SQLite3 engine. This engine does not know how to interpret GeomFromGPB(), hence the error no such function: GeomFromGPB.
Steps to reproduce the issue
- Create a QGIS project with a GeoPackage (.gpkg) layer containing a geometry column.
- Example: layer name actions_localisees, field Avancement.
- Publish the project in Lizmap Web Client 3.9.2.
- Configure a Form filter in the Lizmap plugin for the layer:
- Filter type: uniquevalues
- Field: Avancement
- Provider automatically set to ogr
- Open the Lizmap project in the browser.
- Use the filter to select one or several values.
- Check the Lizmap server log (var/log/error.log).
Versions, safeguards, check summary etc
Versions :
- Lizmap Web Client : 3.9.3 - commit 32bad13 32bad131d
- Lizmap plugin : 4.5.4
- QGIS Desktop : 3.40.10
- QGIS Server : 3.40.11
- Py-QGIS-Server : 1.9.6
- QGIS Server plugin atlasprint : 3.4.3
- QGIS Server plugin lizmap_server : 2.14.1
- QGIS Server plugin wfsOutputExtension : 1.8.3
Check Lizmap plugin
- I have done the step just before in the Lizmap QGIS desktop plugin before opening this ticket. Otherwise, my ticket is not considered valid and might get closed.
Operating system
Ubuntu 20.04
Browsers
Firefox
Browsers version
LTR
Relevant log output
2025-10-10 09:30:18 192.168.200.1 lizmapadmin Error in query (no such function: GeomFromGPB ( SELECT AsGeoJSON(Extent(Transform(GeomFromGPB("geom"), 2056)), 8, 1) AS bbox FROM actions_localisees WHERE 2>1 AND ( "Avancement" IN ( 'En cours' ) )))
2025-10-10 09:30:10 [2] Undefined array key "authcfg" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
2025-10-10 09:30:10 [2] Undefined array key "schema" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
2025-10-10 09:30:10 [2] Undefined array key "tablename" /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/qgisVectorLayerDatasource.class.php 166
2025-10-10 09:30:10 [2] SQLite3::query(): Unable to prepare statement: 1, no such function: GeomFromGPB /var/www/lizmap-web-client/vendor/jelix/jelix/lib/jelix/plugins/db/sqlite3/sqlite3.dbconnection.php 129