Search code examples
cqlgeoserver

Cross-layer filtering extension with more then 2 filter query is not working


i have a Query like below

http://localhost:8080/geoserver/wfs/?service=wfs&version=1.1.0&outputFormat=json&request=getfeature&typename=tiger:poly_landmarks,tiger:poi&cql_filter=INTERSECTS(the_geom, querySingle('tiger:poly_landmarks', 'the_geom','LAND=83','CFCC=H11'))

Which gives 3 features

    {
"type": "FeatureCollection"
"totalFeatures": 3
"features": [3]
0:  {
"type": "Feature"
"id": "poly_landmarks.3"
...More

But if i add one more filter to the querySingle 'LANAME=East River' as below

http://localhost:8080/geoserver/wfs/?service=wfs&version=1.1.0&outputFormat=json&request=getfeature&typename=tiger:poly_landmarks,tiger:poi&cql_filter=INTERSECTS(the_geom, querySingle('tiger:poly_landmarks', 'the_geom','LAND=83','CFCC=H11','LANAME=East River'))

Gives error saying

<ows:ExceptionReport version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>Could not parse CQL filter list. Function not found. Parsing : INTERSECTS(the_geom, querySingle('tiger:poly_landmarks', 'the_geom','LAND=83','CFCC=H11','LANAME=East River')).</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

Solution

  • For the documentation it seems that querySingle only takes 3 arguments so your way won't work. I suspect (i.e. I haven't tested this in this context) you can construct a more complex CQL filter by using AND. So I would try

     querySingle('tiger:poly_landmarks', 'the_geom','LAND=83 AND CFCC=H11 AND LANAME=East River'))