FILTER 示例

发送反馈


示例

本示例中对 WFS 服务 data-world/wfs100进行了3次 GetFeature 操作,可以执行 GET 请求,也可对 http://localhost:8090/iserver/services/data-world/wfs100 执行 POST 请求。

  1. DWithin

执行 GET 请求,在 World:Capitals 获取在(0,0)点周围10°范围内的 Feature,请求体为:

http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=World:Capitals&PROPERTYNAME=(SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom)&Filter= (<Filter xmlns="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><ogc:DWithin xmlns:ogc="http://www.opengis.net/ogc"> <ogc:PropertyName>the_geom</ogc:PropertyName>    <gml:Point> <gml:coordinates>0,0</gml:coordinates> </gml:Point>    <ogc:Distance>10</ogc:Distance></ogc:DWithin></Filter>)

或执行 POST 请求,请求体为:

<?xml version="1.0" ?>

<GetFeature version="1.1.0" service="WFS" handle="Query01"

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

xmlns:gml="http://www.opengis.net/gml" xmlns:World="http://www.someserver.com/World"

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

xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd">

<Query typeName="World:Capitals">

<gml:PropertyName>SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom</gml:PropertyName>

<ogc:Filter>

<ogc:DWITHIN>

<ogc:PropertyName>the_geom</ogc:PropertyName>

<gml:Point>

     <gml:coordinates>0,0</gml:coordinates>

 </gml:Point>

 <ogc:Distance>10</ogc:Distance>

</ogc:DWITHIN>

</ogc:Filter>

</Query>

</GetFeature>

      响应结果如下:

       

 

  1. Disjoint

执行请求,在 World:Capitals 获取与指定几何对象相离的 Feature,请求体为:

http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=World:Capitals&PROPERTYNAME=(SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom)&Filter= (<Filter xmlns:gml="http://www.opengis.net/gml">

<ogc:Disjoint xmlns:ogc="http://www.opengis.net/ogc"> <ogc:PropertyName>the_geom</ogc:PropertyName><gml:MultiPolygon> <gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-160,-80 -160,80 160,80 160,-80 -160,-80</gml:coordinates></gml:LinearRing>

</gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></ogc:Disjoint></Filter>)

或执行 POST 请求,请求体为:

<?xml version="1.0" ?>

<GetFeature version="1.1.0" service="WFS" handle="Query01"

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

xmlns:gml="http://www.opengis.net/gml" xmlns:World="http://www.someserver.com/World"

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

xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd">

<Query typeName="World:Capitals">

<wfs:PropertyName>SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom</wfs:PropertyName>

<ogc:Filter>

<ogc:Disjoint xmlns:ogc="http://www.opengis.net/ogc">

    <ogc:PropertyName>the_geom</ogc:PropertyName>

    <gml:MultiPolygon>

      <gml:polygonMember>

        <gml:Polygon>

          <gml:outerBoundaryIs>

            <gml:LinearRing>

              <gml:coordinates>-160,-80 -160,80 160,80 160,-80 -160,-80</gml:coordinates>

            </gml:LinearRing>

          </gml:outerBoundaryIs>

        </gml:Polygon>

      </gml:polygonMember>

    </gml:MultiPolygon>

  </ogc:Disjoint>

</ogc:Filter>

</Query>

</GetFeature>

响应结果如下:

       

  1. PropertyIsLessThan

执行请求,在 World:Capitals 获取 SMID 小于10的 Feature,请求体为:

http://localhost:8090/iserver/services/data-world/wfs100?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=World:Capitals&PROPERTYNAME=(SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom)&Filter= (<Filter>

<ogc:PropertyIsLessThan xmlns:ogc="http://www.opengis.net/ogc"><ogc:PropertyName>SMID</ogc:PropertyName>

<ogc:Literal>10</ogc:Literal></ogc:PropertyIsLessThan></Filter>)

或执行 POST 请求,请求体为:

<?xml version="1.0" ?>

<GetFeature version="1.1.0" service="WFS" handle="Query01"

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

xmlns:gml="http://www.opengis.net/gml" xmlns:World="http://www.someserver.com/World"

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

xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd">

<Query typeName="World:Capitals">

<wfs:PropertyName>SMY,SMX,SMUSERID,SMLIBTILEID,SMID,SMGEOMETRYSIZE,COUNTRY,CAP_POP,CAPITAL,the_geom</wfs:PropertyName>

<ogc:Filter>

<ogc:PropertyIsLessThan xmlns:ogc="http://www.opengis.net/ogc">

<ogc:PropertyName>SMID</ogc:PropertyName>

<ogc:Literal>10</ogc:Literal>

</ogc:PropertyIsLessThan>

</ogc:Filter>

</Query>

</GetFeature>

响应结果如下: