4

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

http://localhost:8080/example/ows?
service=WFS&
version=2.0.0&
request=GetFeature&
srsName=epsg:4283&
typeNames=type1,type2&

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?

3

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 ):

http://geoserv.weichand.de:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeName=bvv:gmd_ex,bvv:lkr_ex&srsName=EPSG:31468&bbox=4450407.80325,5324432.56981,4481624.47895,5346224.56688,EPSG:31468

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:

http://localhost:8080/geoserver/topp/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=topp:tasmania_state_boundaries,topp:tasmania_water_bodies

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.