1

I have a WMS that I need to filter with CQL_FILTER parameter using an array of srting IDs.

The layer is published from a PostGIS Table View which is declared like so:

create view mob.daily_origin_all
as select "date", "start", "end", id, inc, totinc, diaginc, offdiaginc, mob.calculateSignalLevel(inc) as "level", country, wkb_geometry as geom from
    (select "date", "start", "end", origin as id, sum(inc) inc, avg(totinc) totinc, avg(diaginc) diaginc, avg(offdiaginc) offdiaginc, max(country) country
    from mob.signals
    where freq = 'daily'
    group by "date", "start", "end", origin) as dlorgall,
    mob.geo
where zone_id = dlorgall.id;

In the GeoServer Layer Preview page, I can try to apply a CQL_FILTER parameter.

Supposing the id I am looking for is XXX, when I do id = 'XXX' I receive the correct response and can visualize the area I need in the map.

However, when I try with id IN ('XXX'), I receive an empty image. So, it seems the request is correct but the result is empty, when it should be equal to the one given by id = 'XXX'.

I also looked at this other question, but it did not help apparently.

And, when I look at the GeoServer log, I see this warning:

WARNING: ID IN (...) is a deprecated syntax, you should use IN (...)

So I am guessing this is a matter of naming the column differently than id. But why should it work in one way and not the other?

2

Ok, it's a matter of wrapping id with double quotes.

"id" IN ('XXX') works fine.

I guess ID is a special name reserved for GeoServer tables, so this way the system knows its the actual name of a column in my layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.