3liz / lizmap-web-client

Transfer a QGIS project on a server, Lizmap is providing the web interface to browse it
https://www.lizmap.com
Mozilla Public License 2.0
260 stars 143 forks source link

Permalink with filter #2552

Open rmarzocchi84 opened 3 years ago

rmarzocchi84 commented 3 years ago

II try to add a permalink filtering a layer, but the function it is not supported using filter and permalink.

I try adding the filter properties in the WMS request

https:\\url?...&filter=layername:field+IN+(+filedvalue+)+

but it seems to do not work (the layer disappear from map!!)

Any idea? It can be a nice option for users..

nboisteault commented 3 years ago

I did not try but it seems like an enhancement :) Maybe someone achieved this behavior so I let 'question' label.

rmarzocchi84 commented 3 years ago

@nboisteault from my test it seems a security problem https://docs.qgis.org/3.16/en/docs/server_manual/services.html#filter

When I add a filter

https://MYURL/mappe/lizmap/www/index.php/view/map/?repository=repo1&project=transitabilita_grafo&bbox=983223.135660956%2C5529467.9215975%2C989152.933212883%2C5539166.51443928&crs=EPSG%3A3857&filter=v_grafo_incongruenze%3A%22UT%3A%22id%22%2BIN%2B%28%2B12%2B%29

filter=v_grafo_incongruenze:UT:id+IN(+12+) filter=v_grafo_incongruenze%3A%22UT%3A%22id%22%2BIN%2B%28%2B12%2B%29

this i sthe error:

<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" version="1.3.0">
<ServiceException code="Security">The filter string "id"+IN+(+12+) has been rejected because of security reasons. Note: Text strings have to be enclosed in single or double quotes. A space between each word / special character is mandatory. Allowed Keywords and special characters are IS,NOT,NULL,AND,OR,IN,=,<,>=,>,>=,!=,',',(,),DMETAPHONE,SOUNDEX. Not allowed are semicolons in the filter expression.</ServiceException>
</ServiceExceptionReport>
nboisteault commented 3 years ago

Did you respect A space between each word / special character is mandatory?

rmarzocchi84 commented 3 years ago

Did you respect A space between each word / special character is mandatory?

Adding spaces filter=v_grafo_incongruenze+:+UT:id+IN(+12+)+ the request works, but not the filter

rmarzocchi84 commented 3 years ago

Sorry filter=v_grafo_incongruenze:+"id"+IN(+12+)+ it works! where: filter=layername:+"field_name"+OPERATOR+'string variable'+ or filter=layername:+"field_name"+OPERATOR+number+

The permalink from filter can be a nice enhancement but just now user can create a script to have the correct URL request

geomoes commented 2 years ago

I've tried to implement this nice feature, but I don't get it to work. See also my post on gis.stackexchange.com. Features are not filtered on the map, but only in the data menu.

The url we are using is: https://ourserver.com/lizmap/index.php/view/map/?repository=xfn&project=xfn_lizmap&filter=v_parcels%3A%22id%22%20IN%20(%2054%20,%2055%20,%2056%20,%2053%20,%2052%20,%20516%20), so that the filter part looks like &filter=v_parcels:"id" IN ( 54 , 55 , 56 , 53 , 52 , 516 ) v_parcels is the original layer name from PostGIS, not the alias given in the Lizmap plugin. For the layer both are configured in the Lizmap plugin in QGIS, the form filter and the attribute table with id as primary key field. The Lizmap version is 3.4.7.

Are there any other prerequisites that I miss to get it to work?

geomoes commented 2 years ago

Meanwhile I'm working with Lizmap version 3.5.3. But still I'm unable to get this filtering by URL to work. &filter=gebiete:"gid" IN ( 11 , 12 ) The PostGIS layer 'gebiete' has identifier 'gid' and the features 11 and 12 exist in the database. In QGIS the layer is published as WFS and in Lizmap-Plugin the layer is set up in the attribute table and the form filter.
I do not find this 'filtering by url' in the documentation.

When I look at the lizmap log-file I get the following error: error 2022-05-09 15:22:00 [0] syntax error, unexpected ')' /var/www/lizmap-web-client-3.5.3/lizmap/modules/filter/controllers/service.classic.php 89

Any idea how to get this to work or where to find documentation about this topic?

Gustry commented 2 years ago

Is this covered by #3074 @nboisteault and others ?

nboisteault commented 2 years ago

@geomoes @rmarzocchi84 Could you test https://github.com/3liz/lizmap-web-client/pull/3074 and give us feedback please?

Gustry commented 2 years ago

~So it's included in latest 3.6 releases~

3liz-bot commented 2 years ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

3liz-bot commented 1 year ago

This issue is missing some feedbacks. 👻 Please have a look to the discussion, thanks. 🦎

geomoes commented 1 year ago

Hi, it took me a time to wait until the final release of the 3.6.0 version of Lizmap. Then I had issues to get the required qgis-server-plugin up and running. Now I want to test the new possibility to filter by passing filter conditions via URL. I'm trying the following syntax as noted already above: &filter=gebiete:"gid" IN ( 11 , 12 ) &filter=gebiete:"gid"=12 but I don't get it to work.

Could You please provide the right syntax that is needed?