3

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

The result looks like so: enter image description here

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

Which looks like this: enter image description here

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 &quot;&lt;EOF&gt;&quot; at line 1, column 12.
Was expecting one of:
    &quot;not&quot; ...
    &quot;id&quot; ...
    &quot;in&quot; ...
    &lt;IDENTIFIER&gt; ...
    &lt;DATE_TIME&gt; ...
    &quot;(&quot; ...
    &quot;[&quot; ...
    &lt;DATE&gt; ...
    &quot;-&quot; ...
    &lt;INTEGER_LITERAL&gt; ...
    &lt;FLOATING_LITERAL&gt; ...
    &lt;STRING_LITERAL&gt; ...
    &quot;true&quot; ...
    &quot;false&quot; ...
    &quot;point&quot; ...
    &quot;linestring&quot; ...
    &quot;polygon&quot; ...
    &quot;multipoint&quot; ...
    &quot;multilinestring&quot; ...
    &quot;multipolygon&quot; ...
    &quot;geometrycollection&quot; ...
    &quot;envelope&quot; ...
    &quot;include&quot; ...
    &quot;exclude&quot; ...
     Parsing : NAME=&apos;Ohio&apos;;.
</ServiceException></ServiceExceptionReport>
3
  • 1
    According to docs.geoserver.org/stable/en/user/services/wms/vendor.html using semicolon should do it. Perhaps an empty filter has not been tested. Could you make a copy of the cb_2014_us_state_500k layer with another name and make a new trial with a filter like NAME='Texas';NAME='Ohio' ?
    – user30184
    Commented Mar 9, 2016 at 22:38
  • Your test worked with specifying the boarders layer twice and filtering on two different states (there was no error). I'm appending to the question the error I get back when using an empty filter on one of the layers.
    – apricity
    Commented Mar 9, 2016 at 22:46
  • I can get it to work using this, but it's pretty hacky: &CQL_FILTER=true=true;NAME='Texas'
    – apricity
    Commented Mar 9, 2016 at 22:55

1 Answer 1

6

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:

CQL_FILTER=INCLUDE;NAME='Texas'

You can find a full reference the the ECQL filter language that GeoServer uses here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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