Lizmap-web-client: Filter header section shows incorrect number of object when qgis layer has a filter.

Created on 24 Dec 2019  路  19Comments  路  Source: 3liz/lizmap-web-client

I have a postgres table called "poi", it contains 328 records and there is a column called "source" which tells me where the poi comes from.

The current record count by source is:
S1: 23
S2: 223
S3:82

I show these POI's in separate layers in qgis by filtering on the "source" column.

I have added those 3 layers in the filters section of lizmap. When I open the filter window in the lizmap web client, the number in the header section shows 328 objects.

The database table has 328 rows but the layers don't, these should show 23 and 82 objects respectively.

Filter1

Filter 2

I understand that Lizmap only "talks" to qgis server and not directly to the database so I am not sure if it is a qgis server bug or a Lizmap bug.

bug

Most helpful comment

PR #1708 will fix it . Please try and report sucess or failure

All 19 comments

Lizmap often talks to qgis server but sometimes directly to postgres.
We need a link to your project or a copy without any sensitive information to debug.

My map is not online yet. I'm developing on a Linux desktop.

I am planning on publishing sometime in January

I'm now up and running......and I'm very happy with Lizmap so far.......great work !

I created a "dummy" public map with just 2 layers that come from the same PostGIS table to demonstrate. It's a map of rest areas and service areas.

The database table has 320 records, it contains an attribute called "highway" with 2 possible values. 310 records have highway = rest_area and 10 records have highway=service

In my qgis project I added the table twice, renamed each layer and put filters on "highway" = 'rest_area' and "highway" = 'service' respectively and in Lizmap I added the layers in the filters section.

filter1

filter2

lizmapfilters

In the webmap, when I go to the filters, it shows 320 records when the filter is clear. It shows the correct count when it starts filtering but when I clear it, it goes back to showing the record count of the database table without taking the qgis filter into account.

filterfinal

filterfinal2

You can see for yourself at https://www.expedimaps.com. I can provide the project file, lizmap configuration file and direct access to postgis database table if needed. This is open data published under CC 4.0 licence, nothing sensitive or restricted.

I have encountered the same problem.

In QGIS I add a filter on layer data, but when I use the filter I see the count of data without filter

here an example as requested by @nboisteault :
https://www.gishosting.gter.it/lizmap-web-client/lizmap/www/index.php/view/map/?repository=workshop&project=test_filter

Here the geopackage with data:
test_filter_ok.zip

There are three problems:
1) the data contained in a geopackage file. if filtered on a QGIS project are not correctly shown

Here the data not filtered:
image

Here the data filtered:
image

2) the filter count do not works
Data not filtered count:
image

Data filtered count:
image

While on QGIS:
image

3) Also data table do not works for filtered layer

Finally field "Map value" definitions are lost in data table and also in filter (unique value) and this is not nice expecially for filter where decoding is often very useful.

image

QGIS server 3.10.6
LWC 3.3.5

Hi, we have a similar issue.. Qgis server 3.4, LWC 3.3.3, Postgis layers. If we add a filter in Qgis desktop project the counter in Lizmap filter returns the total number of records of Postgis table (image 1) ignoring Qgis desktop filter.
The layer is correctly shown in Lizmap map and the data table in Lizmap (image 2) is the same of Qgis desktop (image3).
Image 1 - Lizmap filter counter:

immagine

Image 2 - Lizmap data table counter:

immagine

Image 3 - Qgis attribute table counter:
immagine

@nboisteault i do not know if my data can be useful for debug. Let me know.

This issue is missing some feedbacks. 馃懟
Please have a look to the discussion, thanks. 馃

@nboisteault It is solved?

@rmarzocchi84 I reopen and I'll take a look when I'll find time.

Thanks @nboisteault . if you have a suggestion to the file to check I can try a PR. Just yesterday we have encountered another issue related to filter https://github.com/3liz/lizmap-web-client/issues/1417 and it is nice if we can help your team

I confirm that LWC count all lines in the queried table => https://github.com/3liz/lizmap-web-client/blob/release_3_3/lizmap/modules/filter/classes/filterDatasource.class.php#L125
@mdouchin To get correct count, do you know if we should query QGIS Server or if we could get and translate QGIS expression to SQL ?

I will propose a PR for this issue

PR #1708 will fix it . Please try and report sucess or failure

@mdouchin Ok for me !

PR merged. The related commit is now in release_3_3 and will land in master soon

@nboisteault @mdouchin we made some tests and I confirm that this problem is solved in LWC 3.3.8
QGIS SIDE
image
LIZMAP SIDE
image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

news24lor picture news24lor  路  7Comments

21Damien picture 21Damien  路  4Comments

josemvm picture josemvm  路  3Comments

tethysgeco picture tethysgeco  路  8Comments

Nokram picture Nokram  路  5Comments