TransWikia.com

Filtering a WMS layer in QGIS Server doesn't accept "IN" operator

Geographic Information Systems Asked on November 23, 2021

I am using OpenLayers to connects to QGIS Server, to serve a WMS layers.

I want to filter the WMS layer according to one attribute. I have followed the documentation to do so. Everything is working fine if I use the ‘=’ operator, like the following, for example:

FILTER=myLayerName: "myAttribute" = 1

But I need to have the criteria using the ‘IN’ operator, because I am filtering on multi values, like the following, for example (doesn’t work)

FILTER=myLayerName: "myAttribute" IN (1, 2, 3)

Could you please advice me with the proper way to use the ‘IN’ operator with Integer values?

One Answer

It might be too late, but still : I ran into the same problem and eventually found this page, where it es explained that

Text strings need to be enclosed with quotes (single quotes for strings, double quotes for attributes) A space between each word / special character is mandatory. Allowed Keywords and special characters are ‘AND’,’OR’,’IN’,’=’,’<’,’>=’, ‘>’,’>=’,’!=*,’(‘,’)’. Semicolons in string expressions are not allowed

I tried it on my own QGIS 3.4 server and I could make work something like

FILTER=mylayername:"attribute1" = 'value1' AND "attribute2" < 10000

I believe that in your case, the problem is that your query should look like :

FILTER=myLayerName: "myAttribute" IN ( 1 , 2 , 3 )

i.e. with spaces between each value / word / single character like the parenthesis.

Answered by Darth Kangooroo on November 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP