Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having trouble forming a properly formatted CQL request using geoServer cross layer filer functions and was hoping others could assist. My request is as follows:


The intent is to select the towns that are within a selected District shape.

With the above request a null data set is returned:

<wfs:FeatureCollection xmlns:ogc="" xmlns:AU="" xmlns:tiger="" xmlns:cite="" xmlns:nurc="" xmlns:sde="" xmlns:wfs="" xmlns:topp="" xmlns:it.geosolutions="" xmlns:xsi="" xmlns:sf="" xmlns:ows="" xmlns:gml="" xmlns:xlink="" **numberOfFeatures="0"** timeStamp="2013-03-20T22:36:01.593Z" xsi:schemaLocation=" http://localhost:8080/geoserver/wfs?service=WFS&version=1.1.0&request=DescribeFeatureType&typeName=DHS%3ATownPoints http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd">

I think the formatting of my query string 'CODE=A1' is wrong, so geoServer returns a null set for the queryCollection, meaning the intersection is being performed against a null set. (Note: CODE='A1' works fine if I query Districts directly.)

I have also tried 'CODE='A1'' and some other variations but this nesting always causes an exception similar to the following:

Could not parse CQL filter list. Encountered "A1" at line 1, column 92.
 Was expecting one of:
 ")" ...
 "," ...
 "/" ...
 "*" ...
 "+" ...
 "-" ...
 Parsing : INTERSECTS(the_geom,collectGeometries(queryCollection('AU:Districts','the_geom','CODE='A1''))).

I have looked at lots of examples but cannot find one with a filter string in the queryCollection function.

share|improve this question

1 Answer 1

INTERSECTS(geom, collectGeometries(queryCollection('topp:states', 'the_geom', 'STATE_ABBR=" + "'" + "'" + 'CA' + "'" + "'" + "')))
share|improve this answer

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Welcome to GIS.SE. While this is most likely the solution, some explanation would be useful. –  John Barça Jul 7 at 7:44
It woudn't let me edit my answer the other day! Building the second expression in this manner "'" + "'" + 'CA' + "'" + "'" allowed me to achieve a text attribute filter to query all points, of my data, within the shape of California. –  Danny Jul 9 at 16:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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