FILTER Sample |
In this example, the WFS service data-world/wfs200 has three GetFeature operations, and can execute a POST request on http://localhost:8090/iserver/services/data-world/wfs200.
Execute POST request. In World:Capitals, get Feature within BBOX = 50,40,100,60. The 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>
The response results are as follows:
Execute POST request. In World:Capitals, get Feature separated from the specified geometries. The 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: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:
Execute POST request. In World:Capitals, get Feature whose SMID is less than 500 and CAP_POP is less or equal to 10000. 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: