I'm trying to use CQL filters in WFS, like (with proper URL encoding):

&cql_filter=strEqualsIgnoreCase(name, 'Jane Doe')
&cql_filter=strMatches(name, '(?i).* doe')

But this tells me, e.g.:

java.lang.ClassCastException: org.geotools.filter.function.FilterFunction_strMatches cannot be cast to org.opengis.filter.Filter

The CQL and ECQL documentation claims:

CQL/ECQL can use any of the filter functions available in GeoServer.

The functions I'm trying to use are listed there, and I can indeed use some of the other functions, like the following works just fine:

&cql_filter=strToLowerCase(name) like '% doe'

However, many other functions throw an error like above.


The solution is simple: anything that yields a boolean value must be explicitly compared to true. Like (with proper URL encoding):

&cql_filter=strEqualsIgnoreCase(name, 'Jane Doe') = true
&cql_filter=strMatches(name, '(?i).* doe') = true

For me, this error pops up when I export an SLD style from QGIS and load it into geoserver.

Specifically, in my styles the 'escape' and 'rotation' and 'dingbats' are where the errors sit.

escape --> escapeChar
<se:Rotation\> --> <se:Rotation></se:Rotation>
D050000L --> Dingbats

I'm sure there are others, and upgrades, and the like. But these types of nits often come up in Geoserver's Java parsing.

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.