0

I am trying to do a WFS POST request to https://environment.data.gov.uk/spatialdata/crow-act-2000-section-4-conclusive-registered-common-land-england/wfs where I need to send a list of polygons and find out if any of them are intersecting with the layers found on the endpoint. I have done the GetCapabilities check so I know that it can accept gml:Polygon.

This is my request body so far:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wfs:GetFeature maxFeatures="5000" version="1.1.0" service="WFS" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" resultType="hits" xmlns:fes="http://www.opengis.net/fes/2.0">
    <wfs:Query typeName="ms:Crow_Act_2000_Section_4_Conclusive_Registered_Common_Land_England">
       <ogc:Filter>
            <ogc:Or>
                <ogc:Intersects>
                    <ogc:PropertyName>SHAPE</ogc:PropertyName>
                    <gml:Polygon srsName="urn:ogc:def:crs:EPSG::27700">
                        <gml:exterior>
                            <gml:LinearRing>
                                <gml:posList>352722 488465 505172 482115 558353 140008 304353 111433 352722 488465</gml:posList>
                            </gml:LinearRing>
                        </gml:exterior>
                    </gml:Polygon>
                </ogc:Intersects>
                <ogc:Intersects>
                    <ogc:PropertyName>SHAPE</ogc:PropertyName>
                    <gml:Polygon srsName="urn:ogc:def:crs:EPSG::27700">
                        <gml:exterior>
                            <gml:LinearRing>
                                <gml:posList>289146 331504 289148 331824 289535 331814 289516 331502 289146 331504</gml:posList>
                            </gml:LinearRing>
                        </gml:exterior>
                    </gml:Polygon>
                </ogc:Intersects>
            </ogc:Or>
        </ogc:Filter>
    </wfs:Query>
</wfs:GetFeature>

And the error that I get back looks like this:

<ExceptionReport
 version="2.0.0" xmlns="http://www.opengis.net/ows/1.1"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsAll.xsd"
>
    <Exception exceptionCode="OperationProcessingFailed">
        <ExceptionText>
            <![CDATA[Operator 'Or' : operand is wrong.]]>
        </ExceptionText>
    </Exception>
    <Exception exceptionCode="OperationProcessingFailed">
        <ExceptionText>
            <![CDATA[Operator 'Intersects' can only be one per filter request.]]>
        </ExceptionText>
    </Exception>
    <Exception exceptionCode="OperationProcessingFailed">
        <ExceptionText>
            <![CDATA[Operator 'Or' : operand is wrong.]]>
        </ExceptionText>
    </Exception>
    <Exception exceptionCode="OperationProcessingFailed">
        <ExceptionText>
            <![CDATA[Unknown system error.]]>
        </ExceptionText>
    </Exception>
</ExceptionReport>

I am not sure why it is having a problem with the ogc:Or, as this same request body works for a different endpoint (https://datamap.gov.wales/geoserver/wfs) though this other request body does have a different typeName and PropertyName. Would anyone be able to point me in the right direction to why it is not working with the multiple polygons on an Intersects filter query?

1
  • Not that you can do much about this, but looking at the WFS 1.1.0 query in a validator there are two issues. The first is that you need to have a namespace declaration for the ms prefix for the featureType xmlns:ms="https://environment.data.gov.uk/spatialdata/crow-act-2000-section-4-conclusive-registered-common-land-england/wfs" the second issue is the validator tells me that the typename attribute value isn't valid! ~ is not facet-valid with respect to pattern '((\w:)?\w(=\w)?){1,}' for type 'TypeNameListType'.
    – nmtoken
    Commented Jan 5, 2023 at 17:16

2 Answers 2

0

That should work, but I think you may be mixing versions somewhere, as you seem to be asking for a version 1.1.0 service but reference FES (which is WFS 2.0).

<wfs:GetFeature maxFeatures="5000" version="1.1.0" service="WFS" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" resultType="hits" xmlns:fes="http://www.opengis.net/fes/2.0">

Did you specify a version in the URL you POST to? I think your client is confused/confusing the server. Try making it a 2.0.0 request and using the FES or make it a 1.1.0 and be specific in the end point.

The reason the 2nd end point works is because it is a cheap open source program (GeoServer) rather than a very expensive proprietary server (ESRI).

0

Thanks for taking a look at my question, I tried both of your suggestions and unfortunately it didn't work. I suspect you are correct and it is an issue with the source.

I have managed to find an alternative source which uses ESRI ( https://services.arcgis.com/JJzESW51TqeY9uat/ArcGIS/rest/services) and I can do the intersects check that I require with that source.

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Jan 6, 2023 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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