Reputation: 4151
Basically I want to combine 2 cql filters of the same layer and output the result on my geoserver layer. It is similar to this SQl query (my case using PostgreSQL):
select * from table1 where val = 'a'
union all // union all means keeps duplicate
select * from table1 where val = 'b'
I tried using the cql_filter as below but didnt work
cql_filter="val"='a' union "val"='b'
I dont find the cql_filter union function (not union of geometries) in https://docs.geoserver.org/stable/en/user/filter/function_reference.html as well. What is the proper way to use UNION ALL likewise the SQL query in GeoServer cql filter?
Upvotes: 1
Views: 793
Reputation: 10976
You can use or
to join your filters:
cql_filter="val"='a' or "val"='b'
Upvotes: 1
Reputation: 4151
Below solution works but probably not the best.
I made a layer group by combining multiple of same layer instead of just 1 layer
(ns:myLayer)(ns:myLayer)
Then use the cql filter as below
cql_filter="val"='a';"val"='b'
Here's the complete URL sample
http://localhost/geoserver/visualization/ows?service=WFS&version=1.1.0&request=GetFeature&typeNames=(ns:myLayer)(ns:myLayer)&outputFormat=text/javascript&format_options=callback:loadFeatures&srsname=EPSG:3857&cql_filter="val"='a';"val"='b'
Upvotes: 0