2

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.

6

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

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.