FILTER Sample

Feedback


Examples

In this example, three GetFeature operations are performed on the WFS service data-world/wfs200, The http://localhost:8090/iserver/services/data-world/wfs200 performs the POST request.

  1. BBOX

Execute POST request, get BBOX=50,40,100,60 in the range of World:Capitals Feature, request body is:

<?xml version="1.0" ?>

<GetFeature

   version="2.0.0"

   service="WFS"

   xmlns="http://www.opengis.net/wfs/2.0"

   xmlns:fes="http://www.opengis.net/fes/2.0"

   xmlns:gml="http://www.opengis.net/gml/3.2"

   xmlns:World="http://www.someserver.example.com/World"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd

                       http://www.opengis.net/gml/3.2

                       http://schemas.opengis.net/gml/3.2.1/gml.xsd">

   <Query typeNames="World:Capitals">

      <PropertyName>World:SMID</PropertyName>

      <fes:Filter>

         <fes:BBOX>

            <fes:ValueReference>World:Capitals</fes:ValueReference>

               <gml:Envelope>

                  <gml:lowerCorner>50 40</gml:lowerCorner>

                  <gml:upperCorner>100 60</gml:upperCorner>

               </gml:Envelope>

         </fes:BBOX>

      </fes:Filter>

   </Query>

</GetFeature>

#160;     The response results are as follows:

        

 

  1. Disjoint

Execute the POST request and obtain the Feature separated from the specified geometric object in World:Capitals. The body of the request is:

<?xml version="1.0" ?>

<GetFeature

   version="2.0.0"

   service="WFS"

   xmlns="http://www.opengis.net/wfs/2.0"

   xmlns:fes="http://www.opengis.net/fes/2.0"

   xmlns:gml="http://www.opengis.net/gml/3.2"

   xmlns:World="http://www.someserver.example.com/World"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd

                       http://www.opengis.net/gml/3.2

                       http://schemas.opengis.net/gml/3.2.1/gml.xsd">

   <Query typeNames="World:Ocean">

      <PropertyName>World:SMID</PropertyName>

      <PropertyName>World:SMUSERID</PropertyName>

      <fes:Filter>

         <fes:Disjoint>

               <fes:ValueReference>the_geom</fes:ValueReference>

               <gml:Envelope srsName="urn:ogc;def:crs:EPSG::4326">

                  <gml:lowerCorner>-100 -90</gml:lowerCorner>

                  <gml:upperCorner>100 90</gml:upperCorner>

               </gml:Envelope>

            </fes:Disjoint>

      </fes:Filter>

   </Query>

</GetFeature>

The response results are as follows:

        

  1. AndLessThan

Execute a POST request to retrieve features with SMID less than 500 and CAP-POP less than or equal to 10000 from World: Capitals. The request body is:

<?xml version="1.0"?>

<GetFeature

   service="WFS"

   version="2.0.0"

   xmlns="http://www.opengis.net/wfs/2.0"

   xmlns:World="http://www.someserver.example.com/World"

   xmlns:fes="http://www.opengis.net/fes/2.0"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

   xsi:schemaLocation="http://www.opengis.net/wfs/2.0 http://schemas.opengis.net/wfs/2.0/wfs.xsd">

   <Query typeNames="World:Capitals">

      <fes:Filter>

         <fes:And>

            <fes:PropertyIsLessThan>

               <fes:ValueReference>/World:Capitals/World:SMUSERID</fes:ValueReference>

               <fes:Literal>500</fes:Literal>

            </fes:PropertyIsLessThan>

            <fes:PropertyIsLessThanOrEqualTo>

               <fes:ValueReference>/World:Capitals/World:CAP_POP</fes:ValueReference>

               <fes:Literal>10000</fes:Literal>

            </fes:PropertyIsLessThanOrEqualTo>

         </fes:And>

      </fes:Filter>

   </Query>

</GetFeature>

The response results are as follows: