WFS-要素 Web 服务

WFS 标准定义了一些操作,这些操作允许用户在分布式的环境下通过 HTTP 对空间数据进行查询、编辑等操作。

WFS 服务要求服务的接口必须由 XML 描述,另外数据交互必须由 GML 进行,数据过滤采用CQl语言。

一、 种类与操作

客户端想要访问 WFS 服务时,一般会涉及到以下的流程

  • 通过操作获取 WFS 服务支持的操作和要素类(Feature Type,可以理览为 WFS 中的数据集)。
  • (可能)通过操作获取 WFS 服务支持的要素类的定义。
  • 客户端发送某个操作的请求。
  • WFS 服务处理请求。
  • WFS 服务返回处理的结果和状态。

二、客户端流程中的操作

  1. GetCapabilities(获取服务中的要素类及支持的操作)
  2. DescribeFeatureType(描述要素类的信息)
  3. GetFeature(获取要素)
  4. GetGmlObject(通过 XLink 获取 GML 对象)
  5. Transaction(创建、更新、删除数据的事务操作)
  6. LockFeature(在事务过程中锁定要素)

这些操作并不是必须全部实现,而是实现全部或部分。根据所支持的操作不同,WFS 可以分为 3 类:

  • Basic WFS(就是最常被提及的 WFS,必须支持 GetCapabilities/ DescribeFeatureType GetFeature 操作,在功能上意味着提供一个叧读的数据服务)。
  • XLink WFS(必须在 Basic WFS 基础上加上 GetGmlObject 操作)
  • Transaction WFS(也有称为 WFS-T,必须在 Basic WFS 基础上加上 Transaction 操作以支持编辑数据,另外也可以加GetGmlObject/LockFeature 操作)。

三 、GetCapabilities 操作

  • KVP 格式请求

GetCapabilities 操作需要以下的参数:

参数 是否必须 默认值
SERVICE WFS
REQUEST=GetCapabilities
//WFS 使用 KVP 格式的 GetCapabilities 操作示例
http://www.someserver.com/wfs?SERVICE=WFS&REQUEST=GetCapabilities
  • XML 格式请求

// XML 格式的 GetCapabilities 操作示例
<?xml version="1.0" ?>

<GetCapabilities service="WFS" xmlns="http://www.opengis.net/wfs"

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

xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd" />
  • 响应示例

//WFS 的 GetCapabilities 操作的响应示例
<?xml version="1.0" encoding="UTF-8"?>
<wfs:WFS_Capabilites xmlns:ows="http://www.opengis.net/ows"
xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs"
xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs ../wfs.xsd" version="1.1.0"

updateSequence="0">

<ows:ServiceIdentification>

<ows:ServiceType>WFSows:ServiceType>

<ows:ServiceTypeVersion>1.1.0ows:ServiceTypeVersion>

<ows:Title>OGC Member WFSows:Title>

...

ows:ServiceIdentification>

<ows:ServiceProvider>

<ows:ProviderName>BlueOxows:ProviderName>

<ows:ServiceContact>

...

ows:ServiceContact>

ows:ServiceProvider>

<ows:OperationsMetadata>

<ows:Operation name="GetCapabilities">

...

ows:Operation>

<ows:Operation name="DescribeFeatureType">

...

ows:Operation>

<ows:Operation name="GetFeature">

...

ows:Operation>

<ows:Operation name="GetFeatureWithLock">

...

ows:Operation>

<ows:Operation name="GetGMLObject">

...

ows:Operation>

<ows:Operation name="LockFeature">

...

ows:Operation>

<ows:Operation name="Transaction">

...

ows:Operation>

<ows:Parameter name="srsName">

<ows:Value>EPSG:4326ows:Value>

ows:Parameter>

<ows:Constraint name="DefaultMaxFeatures">

<ows:Value>10000ows:Value>

ows:Constraint>

...

ows:OperationsMetadata>

<wfs:FeatureTypeList>

<wfs:FeatureType xmlns:bo="http://www.BlueOx.org/BlueOx">

<wfs:DefaultSRS>EPSG:62696405wfs:DefaultSRS>

<wfs:OutputFormats>

<wfs:Format>text/xml; subtype=gml/3.1.1wfs:Format>

wfs:OutputFormats>

<ows:WGS84BoundingBox>

<ows:LowerCorner>-180 -90ows:LowerCorner>

<ows:UpperCorner>180 90ows:UpperCorner>

ows:WGS84BoundingBox>

...

wfs:FeatureType>

wfs:FeatureTypeList>

<wfs:ServesGMLObjectTypeList>

<wfs:GMLObjectType xmlns:bo="http://www.BlueOx.org/BlueOx">

<wfs:Name>bo:OxTypewfs:Name>

<wfs:Title>Babe's Lineagewfs:Title>

<wfs:OutputFormats>

<wfs:Format>text/xml; subtype=gml/3.1.1wfs:Format>

<wfs:Format>text/xhmtlwfs:Format>

wfs:OutputFormats>

wfs:GMLObjectType>

wfs:ServesGMLObjectTypeList>

<wfs:SupportsGMLObjectTypeList>

<wfs:GMLObjectType>

<wfs:Name>gml:PointTypewfs:Name>

<wfs:OutputFormats>

<wfs:Format>text/xml; subtype=gml/3.1.1wfs:Format>

<wfs:Format>text/xhtmlwfs:Format>

wfs:OutputFormats>

wfs:GMLObjectType>

...

wfs:SupportsGMLObjectTypeList>

<ogc:Filter_Capabilities>

<ogc:Spatial_Capabilities>

<ogc:GeometryOperands>

<ogc:GeometryOperand>gml:Envelopeogc:GeometryOperand>

<ogc:GeometryOperand>gml:Pointogc:GeometryOperand>

<ogc:GeometryOperand>gml:LineStringogc:GeometryOperand>

<ogc:GeometryOperand>gml:Polygonogc:GeometryOperand>

...

ogc:GeometryOperands>

<ogc:SpatialOperators>

<ogc:SpatialOperator name="BBOX" />

<ogc:SpatialOperator name="Equals" />

<ogc:SpatialOperator name="Disjoint" />

<ogc:SpatialOperator name="Intersects" />

<ogc:SpatialOperator name="Touches" />

<ogc:SpatialOperator name="Crosses" />

<ogc:SpatialOperator name="Within" />

<ogc:SpatialOperator name="Contains" />

<ogc:SpatialOperator name="Overlaps" />

<ogc:SpatialOperator name="Beyond" />

ogc:SpatialOperators>

ogc:Spatial_Capabilities>

<ogc:Scalar_Capabilities>

<ogc:LogicalOperators />

<ogc:ComparisonOperators>

<ogc:ComparisonOperator>LessThanogc:ComparisonOperator>

<ogc:ComparisonOperator>GreaterThanogc:ComparisonOperator>

<ogc:ComparisonOperator>LessThanEqualToogc:ComparisonOperator>

<ogc:ComparisonOperator>GreaterThanEqualToogc:ComparisonOperator>

<ogc:ComparisonOperator>EqualToogc:ComparisonOperator>

<ogc:ComparisonOperator>NotEqualToogc:ComparisonOperator>

<ogc:ComparisonOperator>Likeogc:ComparisonOperator>

<ogc:ComparisonOperator>Betweenogc:ComparisonOperator>

<ogc:ComparisonOperator>NullCheckogc:ComparisonOperator>

ogc:ComparisonOperators>

<ogc:ArithmeticOperators>

<ogc:SimpleArithmetic />

<ogc:Functions>

<ogc:FunctionNames>

<ogc:FunctionName nArgs="1">MINogc:FunctionName>

<ogc:FunctionName nArgs="1">MAXogc:FunctionName>

<ogc:FunctionName nArgs="1">SINogc:FunctionName>

<ogc:FunctionName nArgs="1">COSogc:FunctionName>

<ogc:FunctionName nArgs="1">TANogc:FunctionName>

ogc:FunctionNames>

ogc:Functions>

ogc:ArithmeticOperators>

ogc:Scalar_Capabilities>

<ogc:Id_Capabilities>

<ogc:EID />

<ogc:FID />

ogc:Id_Capabilities>

ogc:Filter_Capabilities>

wfs:WFS_Capabilites>

四、 DescribeFeatureType 操作

  • KVP 格式请求

DescribeFeatureType 操作需要以下的参数

参数 是否必须 默认值
VERSION 1.1.0
SERVICE WFS
REQUEST=DescribeFeatureType
TYPENAME
OUTPUTFORMAT text/xml; subtype=gml/3.1.1

//KVP 格式的 DescribeFeatureType 操作
http://www.someserver.com/wfs?
SERVICE=WFS&
VERSION=1.1.0&
REQUEST=DescribeFeatureType&
TYPENAME=TreesA_1M,BuiltUpA_1M
  • XML 格式请求

<xml version="1.0" ?>
<
DescribeFeatureType
 version
="1.1.0"
service
="WFS"
outputFormat
="text/xml;subtype=gml/3.1.1"
xmlns
="http://www.opengis.net/wfs"
xmlns
:myns
="http://www.myserver.com/myns"
xmlns
:xsi
="http://www.w3.org/2001/XMLSchema-instance"
xsi
:schemaLocation
="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd"
>
<
TypeName
>
<myns:PersonTypeName
>

<DescribeFeatureType
>

版权声明:
作者:Gomo
链接:https://www.develophm.com/index.php/wfs-%e8%a6%81%e7%b4%a0-web-%e6%9c%8d%e5%8a%a1/1565/
来源:开发之家
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>