3

Depending on this example

I've created the following WPS request to get the nearst airport from a given point.

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:tst="tst" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
  <ows:Identifier>gs:Nearest</ows:Identifier>
  <wps:DataInputs>
    <wps:Input>
      <ows:Identifier>features</ows:Identifier>
      <wps:Reference mimeType="text/xml; subtype=wfs-collection/1.0" xlink:href="http://geoserver/wfs" method="POST">
        <wps:Body>
          <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
            <wfs:Query typeName="tst:ne_10m_airports"/>
                 <ogc:Filter>
                     <ogc:PropertyIsGreaterThan>
                          <ogc:PropertyName>scalerank</ogc:PropertyName>
                          <ogc:Literal>5</ogc:Literal>
                     </ogc:PropertyIsGreaterThan>
                 </ogc:Filter>
          </wfs:GetFeature>
        </wps:Body>
      </wps:Reference>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>point</ows:Identifier>
      <wps:Data>
        <wps:ComplexData mimeType="application/json">
        <![CDATA[
        {
          "type": "Point",
          "coordinates": [
              21.5,
              15.5
          ]
        }
        ]]>
      </wps:ComplexData>
      </wps:Data>
    </wps:Input>
    <wps:Input>
      <ows:Identifier>crs</ows:Identifier>
      <wps:Data>
        <wps:LiteralData>EPSG:4326</wps:LiteralData>
      </wps:Data>
    </wps:Input>
  </wps:DataInputs>
  <wps:ResponseForm>
    <wps:RawDataOutput mimeType="application/json">
      <ows:Identifier>result</ows:Identifier>
    </wps:RawDataOutput>
  </wps:ResponseForm>
</wps:Execute>

The filter inside the WFS:Query is not executed, although I put a criteria scalerank > 5, the WPS request returns an airport with scalerank = 4 !!

What am I missing or doing wrong?

1 Answer 1

5

Your request isn't valid, the query must contain the filter.

     <wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2">
     <wfs:Query typeName="tst:ne_10m_airports">
             <ogc:Filter>
                 <ogc:PropertyIsGreaterThan>
                      <ogc:PropertyName>scalerank</ogc:PropertyName>
                      <ogc:Literal>5</ogc:Literal>
                 </ogc:PropertyIsGreaterThan>
             </ogc:Filter>
      </wfs:Query>
      </wfs:GetFeature>
1
  • This is a great answer, because the WPS Request builder in Geoserver doesn't seem to allow putting the filter in the query. This process implies the filter is in a separate parameter to the process Commented Apr 1, 2020 at 22:55

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.