I want to join two feature types in my WFS in a union. How can I achieve this using CQL? E.g.


This returns an error:

Join query must specify a filter

I'm trying to append a cql_filter parameter, but the ones I try don't work.

What filter can I use to grab both types, in any format?


Did I understood you right, that you basically want to request two layers in one Request? If so then just use "typeName" instead of "typeNames". See this request of two layers at the same time ( bvv:gmd_ex and bvv:lkr_ex ):


just tested the the query again on a newer version of Geoserver (2.6.1, with manually installed querylayer module ) and this works there,too:


this works also with filter:

http://localhost:8080/geoserver/topp/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=topp:tasmania_state_boundaries,topp:tasmania_water_bodies&CQL_FILTER=INTERSECTS(the_geom,collectGeometries(queryCollection('topp:tasmania_water_bodies', 'the_geom', 'INCLUDE')))

Loading the saved WFS-Response afterwards into QGIS:

enter image description here

enter image description here

  • Your query seems to work but it must be a bug in GeoServer. In WFS 2.0 "typeName" has really changed to "typeNames". Michael's query should work, your query should fail because of unknown keyword. If we accept that GeoServer is right in being lenient with "typeName" it should still work correctly with "typeNames". – user30184 Jan 29 '15 at 15:00
  • Warning: This example is using GeoServer 2.2. WFS 2.0 joins have been improved since then. – Juergen Weichand Jan 29 '15 at 15:27
  • I agree that typenames would be correct but at my site only typename is working...So perhaps some sort of quick and dirty but it works ;-) – Thomas B Jan 29 '15 at 17:26

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.