WFS请求XML

本文详细介绍了Web Feature Service (WFS) 的多种查询方式,包括针对多个图层的数据查询、基于矩形范围的地图要素检索、圆周范围内的地图要素请求、基于属性值的查询以及属性值组合查询等。通过具体的XML示例,读者可以了解到如何构造不同的WFS请求来满足特定的数据需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.     多个图层数据查询。

请求体 :

<wfs:GetFeature service="WFS" version=" 1.1.0 "

xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

<wfs:Query typeName="namespace:layername"/>

<wfs:Query typeName="namespace:layername"/>

</wfs:GetFeature>

 

 

NOTE: 图层可以来自不同工作空间。

 

2. 根据矩形范围查询范围内原件。

    <wfs:Query typeName=" namespace:layername ">

    <ogc:Filter>

      <ogc:BBOX>

        <ogc:PropertyName>geom</ogc:PropertyName>

        <gml:Envelope

srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">

           <gml:lowerCorner> 113.02452 23.74715 </gml:lowerCorner>

           <gml:upperCorner>113.02454 23.74718</gml:upperCorner>

        </gml:Envelope>

      </ogc:BBOX>

   </ogc:Filter>

  </wfs:Query>

 

范围坐标参数顺序左下,右上。

 

3.WFS 请求某一圆周范围的地图要素

<wfs:GetFeature service="WFS" version="1.1.0"

  xmlns:topp="http://www.openplans.org/topp"

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

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

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

 

  xmlns:ows="http://www.opengis.net/ows"

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

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

                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

                     

  <wfs:Query typeName="namespace:layername ">

    <ogc:Filter>

         <ogc:DWithin>

           <ogc:PropertyName>geom</ogc:PropertyName>

           <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">

             <gml:coordinates>113.02452,23.74715</gml:coordinates>

           </gml:Point>

           <ogc:Distance>0.0001</ogc:Distance>

         </ogc:DWithin>

      </ogc:Filter>

  </wfs:Query>

</wfs:GetFeature>

 

4. 根据属性值查询

<wfs:GetFeature service="WFS" version="1.1.0"

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

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

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

  xmlns:ows="http://www.opengis.net/ows"

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

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

                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

                     

  <wfs:Query typeName="namespace:layername ">

    <ogc:Filter>

         < ogc:PropertyIsEqualTo >

           <ogc:PropertyName>sbmc</ogc:PropertyName>

              <Literal>XXX 开关 </Literal>

         </ ogc:PropertyIsEqualTo>

      </ogc:Filter>

  </wfs:Query>

</wfs:GetFeature>

 

 

 

5. 根据属性值组合查询

<wfs:GetFeature service="WFS" version="1.1.0"

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

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

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

  xmlns:ows="http://www.opengis.net/ows"

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

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

                      http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">

                     

  <wfs:Query typeName="namespace:layername ">

    <ogc:Filter>

      <ogc:Or>

<ogc:And>  

<ogc:PropertyIsEqualTo>

           <ogc:PropertyName>propertyname</ogc:PropertyName>

            <Literal>XXX </Literal>

         </ ogc:PropertyIsEqualTo>

<ogc:PropertyIsEqualTo>

           <ogc:PropertyName>propertyname</ogc:PropertyName>

            <Literal>XXX </Literal>

         </ ogc:PropertyIsEqualTo>

 

  </ogc:And>

<ogc:PropertyIsEqualTo>

           <ogc:PropertyName>propertyname</ogc:PropertyName>

            <Literal>XXX </Literal>

         </ ogc:PropertyIsEqualTo>

<ogc:PropertyIsEqualTo>

           <ogc:PropertyName>propertyname</ogc:PropertyName>

            <Literal>XXX </Literal>

         </ ogc:PropertyIsEqualTo>

  </ogc:Or>

  </wfs:Query>

</wfs:GetFeature>

 

 

1)        Equal :第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsEqualTo><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsEqualTo>
2)        NotEqual
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsNotEqualTo><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsNotEqualTo>
3)        Less
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsLessThan><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsLessThan>
4)        Greater
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsGreaterThan><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsGreaterThan>
5)        LessOrEqual
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsLessThanOrEqualTo><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsLessThanOrEqualTo>
6)        GreaterOrEqual
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsGreaterThanOrEqualTo><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsGreaterThanOrEqualTo>
7)        Like
:第一个 %s 填写字段名称,第二个 %s 填写字段值
<PropertyIsLike wildCard="*" singleChar="?" escapeChar="/"><PropertyName>%s</PropertyName><Literal>%s</Literal></PropertyIsLike>
8)        IsNull
:第一个 %s 填写字段名称
<PropertyIsNull><PropertyName>%s</PropertyName></PropertyIsNull>
9)        Between
:第一个 %s 填写字段名称,第二个 %s 填写字段值下限,第三个 %s 填写字段值上限
<PropertyIsBetween><PropertyName>%s</PropertyName><LowerBoundary>%s</LowerBoundary><UpperBoundary>%s</UpperBoundary></PropertyIsBetween>
综上所述, 的例子中属性查询语句部分可以直接写成:
<And><PropertyIsLike wildCard="*" singleChar="?" escapeChar="/"><PropertyName>name</PropertyName><Literal>
新百商场 *</Literal></PropertyIsLike><PropertyIsEqualTo><PropertyName>kind</PropertyName><Literal>2200</Literal></PropertyIsEqualTo></And>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值