Lizmap-web-client: Filter data with form errors

Created on 21 Jun 2019  路  17Comments  路  Source: 3liz/lizmap-web-client

What is the bug?

Filter data with forms errors

Steps to reproduce the issue

Trying to insert a filter form in qgis project for search but it seems have problem in attribute table and localte by layer too.

Expected behavior

Same project, same VM, ecc. but 2 instance of lizmap (3.3 rc and 3.4 pre) give different behavior. I take a simple postgres layer of poligons to make a test work for those tree tools:
1) locate by layer ( with optional group enabled)
2) attribute table
3) filter data with form

Lizmap 3.3 RC 2

  • the filter data form don't appear in the sx bar menu', so no filter form.
  • the locate by layer tool go perfect
  • the attribute table go perfect

Lizmap 3.4pre.190426

  • the filter data form appear but don't work. Render the right form but without data.
  • the locate by layer tool go wrong too, not showing data to select,
  • the attribute table seems to be waiting in a infinite loop

logs

Lizmap 3.3 RC 2 log

2019-06-21 12:16:11 192.168.63.22   warning 2019-06-21 12:16:11 [2] strpos(): Empty needle  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapProject.class.php    438

2019-06-21 12:16:11 192.168.63.22   error   2019-06-21 12:16:11 192.168.63.22   [403]   query non valida (ERRORE:  identificativo delimitato di lunghezza zero a o presso """"
LINE 3: ...pe_leng", "indice_comportamento", "zona_pianura", "", "geom"...
                                                             ^(
        WITH source AS (
         SELECT "id", "id_foglio", "belfiore", "foglio", "comune", "shape_area", "shape_leng", "indice_comportamento", "zona_pianura", "", "geom" AS "geosource" FROM "piano_classifica"."CATASTO_fogli" WHERE True
        )
        --SELECT row_to_json(fc, True) AS geojson
        --FROM (
        --    SELECT
        --        'FeatureCollection' As type,
        --        array_to_json(array_agg(f)) As features
        SELECT row_to_json(f, True) AS geojson
            FROM (
                SELECT
                    'Feature' AS type,
         Concat(
            'CATASTO_fogli',
            '.',
            "") AS id,
                        ST_AsGeoJSON(ST_Transform(ST_Envelope(lg.geosource::geometry), 4326))::json As geometry,

                    row_to_json(
                        ( SELECT l FROM
                            (
                                SELECT "id", "id_foglio", "belfiore", "foglio", "comune", "shape_area", "shape_leng", "indice_comportamento", "zona_pianura", ""
                            ) As l
                        )
                    ) As properties
                FROM source As lg
            ) As f
        --) As fc)) /var/www/lizmap-web-client/lib/jelix/plugins/db/pgsql/pgsql.dbconnection.php    174
    /intragis/index.php/lizmap/service/?repository=2&project=test
array (   'repository' => '2',   'project' => 'test',   'module' => 'lizmap',   'action' => 'service:index',   'SERVICE' => 'WFS',   'VERSION' => '1.0.0',   'REQUEST' => 'GetFeature',   'TYPENAME' => 'CATASTO_fogli',   'OUTPUTFORMAT' => 'GeoJSON',   'GEOMETRYNAME' => 'extent', )

    0   pgsqlDbConnection->_doQuery()   /var/www/lizmap-web-client/lib/jelix/db/jDbConnection.class.php : 123
    1   jDbConnection->query()  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapWFSRequest.class.php : 382
    2   lizmapWFSRequest->getfeaturePostgres()  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapWFSRequest.class.php : 137
    3   lizmapWFSRequest->getfeature()  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapOGCRequest.class.php : 71
    4   lizmapOGCRequest->process() /var/www/lizmap-web-client/lizmap/modules/lizmap/controllers/service.classic.php : 1282
    5   serviceCtrl->GetFeature()   /var/www/lizmap-web-client/lizmap/modules/lizmap/controllers/service.classic.php : 99
    6   serviceCtrl->index()    /var/www/lizmap-web-client/lib/jelix/core/jCoordinator.class.php : 225
    7   jCoordinator->process() /var/www/lizmap-web-client/lizmap/www/index.php : 23
2019-06-21 12:16:11 192.168.63.22   warning 2019-06-21 12:16:11 [2] strpos(): Empty needle  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapProject.class.php    438

2019-06-21 12:16:11 192.168.63.22   warning 2019-06-21 12:16:11 [2] strpos(): Empty needle  /var/www/lizmap-web-client/lizmap/modules/lizmap/classes/lizmapProject.class.php    438

Lizmap 3.4pre.190426 log

2019-06-21 12:31:24 192.168.63.22   notice  2019-06-21 12:31:24 [8] Undefined offset: 11    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   183
2019-06-21 12:31:24 192.168.63.22   notice  2019-06-21 12:31:24 [8] Undefined offset: 12    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   184
2019-06-21 12:31:24 192.168.63.22   notice  2019-06-21 12:31:24 [8] Undefined offset: 13    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   185
2019-06-21 12:31:24 192.168.63.22   notice  2019-06-21 12:31:24 [8] Undefined offset: 14    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   186
2019-06-21 12:31:24 192.168.63.22   notice  2019-06-21 12:31:24 [8] Undefined offset: 15    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   187
2019-06-21 12:31:24 192.168.63.22   error   2019-06-21 12:31:24 [0] dbtools, pgsql: unknown table   /var/www/lizmap_devel/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php  242
2019-06-21 12:31:24 192.168.63.22   warning 2019-06-21 12:31:24 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:24 192.168.63.22   warning 2019-06-21 12:31:24 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:24 192.168.63.22   warning 2019-06-21 12:31:24 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:25 192.168.63.22   warning 2019-06-21 12:31:25 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:25 192.168.63.22   warning 2019-06-21 12:31:25 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:25 192.168.63.22   warning 2019-06-21 12:31:25 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:40 192.168.63.22   warning 2019-06-21 12:31:40 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:40 192.168.63.22   warning 2019-06-21 12:31:40 [2] strpos(): Empty needle  /var/www/lizmap_devel/lizmap/modules/lizmap/classes/lizmapProject.class.php 422
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 13    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   163
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 7 /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   179
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 8 /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   180
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 9 /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   181
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 10    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   182
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 11    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   183
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 12    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   184
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 13    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   185
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 14    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   186
2019-06-21 12:31:40 192.168.63.22   notice  2019-06-21 12:31:40 [8] Undefined offset: 15    /var/www/lizmap_devel/lizmap/modules/lizmap/classes/qgisVectorLayer.class.php   187
2019-06-21 12:31:40 192.168.63.22   error   2019-06-21 12:31:40 [0] dbtools, pgsql: unknown table   /var/www/lizmap_devel/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php  242

Environment

Debian 9, Apache 2.4.25, php 7, postgresql 9.6, postgis 2.3.1, qgis server 3.4.8
Qgis 3.6.3 for editing project

bug feedback

All 17 comments

Just for update ...

After upgrading qgis server to 3.4.9 in the same conditions as described, now the filter menu' appear in lizmap 3.3.

@buoncri Thanks for the update. Does it work as expected ?

The same conditions as reported, now.

In 3.3RC2: it is going quite well, except for the zoom and the export button (don't know if the number of the futures can update while filtering).

  • Zoom Button: zoom to the entire layer not the filtered record
  • Export Button: bring to a "Forbidden You don't have permission to access /intragis/index.php/lizmap/service/ on this server."

In 3.4PRE: it is not going. It render the form but don't expose data to select, only the name of the layer to filter. (and "0 freatures")

@mdouchin many many thanks to you for this feature :-D

Could you please pass an archive with the QGIS 3 project and the data ( via https://send.firefox.com/ for example). You can export the data into GeoPackage, and I will test it by importing it into a local postgresql database.

Could you also pass the QGIS project and Lizmap config please ? Please remove any password and other sensitive information inside the .qgs before.

This is the filter window
Cattura

I made a offline version that have the same problems than this is the link. (.qgs, geopackage, and lizmap config file)
https://send.firefox.com/download/fe13aee5f26fda39/#dOFW-mEdz0TqX8PyUJLDBQ

Thanks, I will check and report asap

Update on testing

The filter does not work with data from joined (in layer properties) tables. When using one joined filed the dropdown doesn't appear.

The filter is based on SQL request directly on database. It does not use QGIS capabilities.

Hello,
I'm dealing with a similar problem.
I'm not able to use "locate by layer" and "attribute table" features. I'm not using filter data with form, so I don't know if it's working.
I've tried to use a shp layer instead of a postgis one, it's working well.

In logs, I get :

dbtools, pgsql: unknown table /var/www/html-lizmap/lib/jelix/plugins/db/pgsql/pgsql.dbtools.php 242

On web browser, using development tools, I get :

500 Internal jelix error.

Here is my environment :
Debian 10 , Apache 2.4.38 , PHP 7.3.4 , PostgreSQL 9.6.13 , PostGIS 2.3.1, Qgis server 3.4.9, Qgis client 2.18.18 & 3.4.10 , Lizmap 3.2.4 & 3.4pre.190808

I can provide more details if it can help.

Hello,

My problem was related to table names.

The table name contain a " . " ( it's apn_cadi_01.01.2019 ) .

In file lizmap/modules/lizmap/classes/qgisVectorLayer.class.php ,
the function getDatasourceParameters was returning an incorrect table name (apn_cadi_01).

Around line 200, I replaced
$tableAlone = $exp[1];
with

if (count($exp) > 2 ) { 
   $tableAlone = implode('.',array_slice($exp, 1)); 
} else {
   $tableAlone = $exp[1];
}

It's now returning correct table name ( apn_cadi_01.01.2019 ) , and attribute table is working...

I'm not sure @buoncri 's problem is the same...

The filter works properly here with LWC 3.4pre and QGIS 3.4.x , 3.6.x or 3.8.x. However, the export button returns only a corrupt ODS (spreadsheet) as output format. Isn't it supposed a output vector format like GeoJSON, SHP or KML?

I noticed that the integer primary key in db (postgresql) is required for sql functions (locate, selection and filter) to work properly. Removing the z-value before importing shp to db (polygonZ or multipolygonZ) solved some problems with the same symptoms.
Besides the export function I found another bug: I have a spatial table with 40,526 polygons. The smallest area (hectares) is 0.0019 and the biggest is 82336.0468. I setup the area in filter LWC plugin and when I touch the slider in the webclient the major area changes to 82336.0019, removing (filtering) the last polygon from the map. When I reset the filter the value back to normal. Any idea?

@buoncri
Does issue still occur with LWC 3.3.3 ?
Other issues have to be opened separately please.

@nboisteault
Now I am working on other project, i will check this as soon as possible when i came back to lizmap publishing :-D

OK. Please reopen if issue still occurs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DHSTR67 picture DHSTR67  路  7Comments

danzig666 picture danzig666  路  10Comments

Nokram picture Nokram  路  5Comments

t0xycus picture t0xycus  路  7Comments

cocro picture cocro  路  7Comments