Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permalink with filter #2552

Open
rmarzocchi84 opened this issue Oct 21, 2021 · 20 comments
Open

Permalink with filter #2552

rmarzocchi84 opened this issue Oct 21, 2021 · 20 comments
Labels
enhancement feedback Sponsor or PR needed Either a PR or a sponsor is needed for this feature

Comments

@rmarzocchi84
Copy link
Contributor

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
Copy link
Member

nboisteault commented Oct 22, 2021

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

@nboisteault nboisteault added enhancement Sponsor or PR needed Either a PR or a sponsor is needed for this feature labels Oct 22, 2021
@rmarzocchi84
Copy link
Contributor Author

@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
Copy link
Member

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

@rmarzocchi84
Copy link
Contributor Author

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
Copy link
Contributor Author

rmarzocchi84 commented Nov 15, 2021

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
Copy link

geomoes commented Dec 3, 2021

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
Copy link

geomoes commented May 9, 2022

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
Copy link
Member

Gustry commented Aug 8, 2022

Is this covered by #3074 @nboisteault and others ?

@Gustry Gustry added the feedback label Aug 8, 2022
@nboisteault
Copy link
Member

@geomoes @rmarzocchi84 Could you test #3074 and give us feedback please?

@Gustry
Copy link
Member

Gustry commented Aug 31, 2022

So it's included in latest 3.6 releases

@3liz-bot
Copy link
Contributor

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

@3liz-bot 3liz-bot added stale This ticket might be closed soon and removed stale This ticket might be closed soon labels Oct 11, 2022
@Gustry Gustry added the stale This ticket might be closed soon label Oct 17, 2022
@3liz-bot 3liz-bot removed the stale This ticket might be closed soon label Oct 19, 2022
@3liz-bot
Copy link
Contributor

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

@3liz-bot 3liz-bot added stale This ticket might be closed soon and removed stale This ticket might be closed soon labels Nov 22, 2022
@Gustry Gustry removed the question label Dec 8, 2022
@geomoes
Copy link

geomoes commented Dec 15, 2022

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?

@meyerlor
Copy link

meyerlor commented Feb 4, 2025

@geomoes did you somehow figure it out? Or is there any news about that?

@Gustry
Copy link
Member

Gustry commented Feb 4, 2025

@Gustry Gustry added the feedback label Feb 4, 2025
@meyerlor
Copy link

meyerlor commented Feb 6, 2025

Ahh, after some fiddeling around i got it working.

Note:

  • It is not required to filter for the unique identifier of that layer - any other field works too.
  • WMS/WFS Layer names work better (I have a layer "Flurstücke" which did not work, but using the WFS name "Flurstucke" it did)

Only thing which behaves "strange" is when having &popup=true at the end of the filter, the pop up shows in Lizmap - but the object's geometry is not highlighted in the map (which would be very much desirable)
If i make popup=false the geometrie is highlighted, but obviously the popup will not open.

Should i open a new enhancement proposal for this?

Many thanks for pointing me to the right place in the documentation!

@Gustry
Copy link
Member

Gustry commented Feb 6, 2025

What is the value of https://docs.lizmap.com/current/en/publish/configuration/project.html#wms
Add geometry to feature info response

Can you see it in your HTTP request ?

@meyerlor
Copy link

meyerlor commented Feb 6, 2025

The box is checked - if i just click on any feature of the layer, the geometry is properly highlighted in the map.

When clicking on a feature, two requests are sent:

Image

One for WFS and one for WMS:

Image

I can find more or less the same request when accessing LWC through a created permalink:

Image

I'm not sure though, if those requests are the ones for the pop-up or the feature-highlighting..?

Addendum: switching in the URL to popup=false strangely i do not see any request for the parcel via WMS - although it is perfectly highlighted in the map

@Gustry
Copy link
Member

Gustry commented Feb 6, 2025

I mean, is there the geometry returned in these requests ? (response tab)

@meyerlor
Copy link

meyerlor commented Feb 6, 2025

I do not think so..

This is the response to the WFS request:

Image

And this to the WMS request:

Image

Which is basically the popup..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feedback Sponsor or PR needed Either a PR or a sponsor is needed for this feature
Projects
None yet
Development

No branches or pull requests

6 participants