I understand I can write a GML query like this...

<wfs:GetFeature xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/wfs http://giswebservices.massgis.state.ma.us/geoserver/schemas/wfs/1.0.0/WFS-basic.xsd"
  xmlns:gml="http://www.opengis.net/gml" xmlns:wfs="http://www.opengis.net/wfs"
  xmlns:ogc="http://www.opengis.net/ogc" service="WFS" version="1.0.0">
  <wfs:Query typeName="massgis:GISDATA.SCHOOLS_PT"
        <gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
              <gml:coordinates>-71.591935,42.063582 -71.564217,42.063968 -71.563184,42.014226 -71.591207,42.013596 -71.591935,42.063582</gml:coordinates>

This is fine when you know the geometry ahead of time. If I have a FeatureId of a feature on another layer, is it possible to include this FeatureId somehow and let the GeoServer work out what the geometry is? I've spent ages trying to find examples and found nothing like this. I wonder if perhaps it just isn't possible and I will have to query the server for the geometry, parse it and then send it back to the server. This seems very longwinded.


  • 1
    With standard WFS your should really make one query for getting the feature geometry and insert that into the Within filter of the next query. However, you might be interested in the cross layer filtering capabilities of GeoServer docs.geoserver.org/stable/en/user/extensions/querylayer/…. – user30184 May 8 '19 at 18:55
  • Thanks. I don't have control of the geoserver so looks like my original idea has to be realised and use two queries. Not the end of the world. – m1dst May 9 '19 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.