I have an image mosaic timeseries layer called agdd as well as a shapefile layer called cb_2014_us_state_500k that displays us state boundaries.
I can stack both layers with the following query:
http://server/geoserver/gdd/wms?service=WMS&version=1.1.0&request=GetMap&layers=gdd:agdd,gdd:cb_2014_us_state_500k&time=2016-01-10&styles=&bbox=-125.020833333333,24.0625,-66.479166666662,49.937500000002&width=1400&height=700&srs=EPSG:4269&format=application/openlayers
I can use CQL_FITLER=NAME='Texas' to only show the Texas border in the cb_2014_us_state_500k layer:
http://server/geoserver/gdd/wms?service=WMS&version=1.1.0&request=GetMap&layers=gdd:cb_2014_us_state_500k&CQL_FILTER=NAME=%27Texas%27&styles=&bbox=-179.148909,-14.548699,179.77847,71.365162&width=768&height=330&srs=EPSG:4269&format=application/openlayers
Now I'm trying to both the combine layers AND filter the states layer to Texas all in one request. I tried to use a semicolon in the CQL_FILTER to specify that there are two layers, but it doesn't parse:
http://server/geoserver/gdd/wms?service=WMS&version=1.1.0&request=GetMap&layers=gdd:agdd,gdd:cb_2014_us_state_500k&CQL_FILTER=;NAME='Texas'&time=2016-01-10&styles=&bbox=-125.020833333333,24.0625,-66.479166666662,49.937500000002&width=1400&height=700&srs=EPSG:4269&format=application/openlayers
Any ideas how to write this request?
Here is the error I get when using an empty filter for one of the layers:
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://geoserver-dev.usanpn.org:80/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException>
Could not parse CQL filter list.
Encountered "<EOF>" at line 1, column 12.
Was expecting one of:
"not" ...
"id" ...
"in" ...
<IDENTIFIER> ...
<DATE_TIME> ...
"(" ...
"[" ...
<DATE> ...
"-" ...
<INTEGER_LITERAL> ...
<FLOATING_LITERAL> ...
<STRING_LITERAL> ...
"true" ...
"false" ...
"point" ...
"linestring" ...
"polygon" ...
"multipoint" ...
"multilinestring" ...
"multipolygon" ...
"geometrycollection" ...
"envelope" ...
"include" ...
"exclude" ...
Parsing : NAME='Ohio';.
</ServiceException></ServiceExceptionReport>
Best Answer
You can't pass an empty filter into CQL but you can say you want all the features from that layer by using the special
INCLUDE
filter. So your query should be something like:You can find a full reference the the ECQL filter language that GeoServer uses here.