目录

上一个主题

1.6. VI. OWS-OGC Web 服务通用标准

下一个主题

1.8. VIII. WMS-地图 Web 服务


1.7. VII. WFS-要素 Web 服务

1.7.1. 概述

WFS(OpenGIS® Web Feature Service)当前版本是 1.1.0。WFS 标准定义了一些操作,这些操作允许用户在分布式的环境下通过 HTTP 对空间数据进行查询、编辑等操作。

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

1.7.2. 种类与操作

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

1. 通过操作获取 WFS 服务支持的操作和要素类(Feature Type,可以理览为 WFS 中的数据集)。

2. (可能)通过操作获取 WFS 服务支持的要素类的定义。

3. 客户端发送某个操作的请求。

4. WFS 服务处理请求。

5. WFS 服务返回处理的结果和状态。

上面几个步骤中所提到的“操作”包括:

1. GetCapabilities(获取服务中的要素类及支持的操作)

2. DescribeFeatureType(描述要素类的信息)

3. GetFeature(获取要素)

4. GetGmlObject(通过 XLink 获取 GML 对象)

5. Transaction(创建、更新、删除数据的事务操作)

6. LockFeature(在事务过程中锁定要素)

但是,这些操作并不是必须全部实现,而是实现全部或部分。根据所支持的

操作不同,WFS 可以分为 3 类:

1. Basic WFS(就是最常被提及的 WFS,必须支持 GetCapabilities/ DescribeFeatureType GetFeature 操作,在功能上意味着提供一个叧读的数据服务)

2. XLink WFS(必须在 Basic WFS 基础上加上 GetGmlObject 操作)

3. Transaction WFS(也有称为 WFS-T,必须在 Basic WFS 基础上加上 Transaction 操作以支持编辑数据,另外也可以加上 GetGmlObject/LockFeature 操作)关于服务涉及的基本元素,可以参考前面的章节:《服务涉及的基本元素》。

注意,在后面的内容中,服务的操作叧介绉 Basic WFS 和 Transaction WFS 中需要实现的操作,也就是说 GetCapabilities、DescribeFeatureType、 GetFeature 和 Transaction 操作。

1.7.3. GetCapabilities 操作

1.7.3.1. 1. KVP 格式请求

GetCapabilities 操作需要以下的参数:

参数

是否必须

默认值

SERVICE

WFS

REQUEST=GetCapabilities

以下是一个 WFS 使用 KVP 格式的 GetCapabilities 操作示例:

http://www.someserver.com/wfs?

SERVICE=WFS&

REQUEST=GetCapabilities

1.7.3.2. 2. XML 格式请求

以下是一个 WFS 使用 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" />

1.7.3.3. 3. 响应示例

以下是一个 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>

1.7.4. DescribeFeatureType 操作

1.7.4.1. 1. KVP 格式请求

DescribeFeatureType 操作需要以下的参数:

参数

是否必须

默认值

VERSION

1.1.0

SERVICE

WFS

REQUEST=DescribeFeatureType

TYPENAME

OUTPUTFORMAT

text/xml; subtype=gml/3.1.1

以下是一个 WFS 使用 KVP 格式的 DescribeFeatureType 操作示例:

http://www.someserver.com/wfs?

SERVICE=WFS&

VERSION=1.1.0&

REQUEST=DescribeFeatureType&

TYPENAME=TreesA_1M,BuiltUpA_1M

1.7.4.2. 2. XML 格式请求

以下是一个 WFS 使用 XML 格式的 DescribeFeatureType 操作示例:

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
>

1.7.4.3. 3. 响应示例

以下是一个 WFS 的 DescribeFeatureType 操作的响应示例:

xml version="1.0" ?>


<
wfs
:FeatureCollection
xmlns
="http://www.someserver.com/myns"


xmlns
:myns
="http://www.someserver.com/myns"
xmlns
:wfs
="http://www.opengis.net/wfs"


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


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


http://www.someserver.com/myns ex10.xsd"
>


<
gml
:boundedBy
>


<
gml
:Envelope
>


<
gml
:coord
>


<
gml
:X
>
10gml
:X
>


<
gml
:Y
>
10gml
:Y
>


gml
:coord
>


<
gml
:coord
>


<
gml
:X
>
20gml
:X
>


<
gml
:Y
>
20gml
:Y
>


gml
:coord
>


gml
:Envelope
>


gml
:boundedBy
>


<
gml
:featureMember
>


<
Person
>


<
myns
:lastName
>
Smithmyns
:lastName
>


<
myns
:firstName
>
Fredmyns
:firstName
>


<
myns
:age
>
35myns
:age
>


<
myns
:sex
>
Malemyns
:sex
>


<
myns
:location
>


<
gml
:Point
>


<
gml
:pos
>
15 15gml
:pos
>


gml
:Point
>


myns
:location
>


<
myns
:mailAddress
>


<
myns
:Address
>


<
myns
:streetName
>
Main St.myns
:streetName
>


<
myns
:streetNumber
>
5myns
:streetNumber
>


<
myns
:city
>
SomeCitymyns
:city
>


<
myns
:province
>
Someprovincemyns
:province
>


<
myns
:postalCode
>
X1X 1X1myns
:postalCode
>


<
myns
:country
>
Canadamyns
:country
>


<
myns
:Address
>


myns
:mailAddress
>


Person
>


gml
:featureMember
>


wfs
:FeatureCollection
>

1.7.5.  GetFeature 操作

1.7.5.1. 1. KVP 格式请求

GetFeature 操作需要以下的参数:

参数

是否必须

默认值

VERSION

1.1.0

SERVICE

WFS

REQUEST=GetFeature

TYPENAME

OUTPUTFORMAT

text/xml; subtype=gml/3.1.1

BBOX

FILTER

SORTBY

MAXFEATURES

PROPERTYNAME

SRSNAME

FEATUREID

EXPIRY

RESULTTYPE

results

FEATUREVERSION

以下是一个WFS使用KVP格式的GetFeature操作示例:

http://www.someserver.com/wfs?

SERVICE=WFS&

VERSION=1.1.0&

REQUEST=GetFeature&

PROPERTYNAME=InWaterA_1M/wkbGeom,InWaterA_1M/tileId&

TYPENAME=InWaterA_1M&

FILTER=InWaterA_1M/wkbGeom

10,10

20 20

1.7.5.2. 2.XML格式请求

以下是一个WFS使用XML格式的GetFeature操作示例:

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
>

1.7.5.3. 3.响应示例

以下是一个WFS的GetFeature操作的响应示例:

xml version="1.0" ?>


<
wfs
:FeatureCollection
 xmlns
="http://www.someserver.com/myns"


xmlns
:myns
="http://www.someserver.com/myns"
 xmlns
:wfs
="http://www.opengis.net/wfs"


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


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


http://www.someserver.com/myns ex10.xsd"
>


<
gml
:boundedBy
>


<
gml
:Envelope
>


<
gml
:coord
>


<
gml
:X
>
10gml
:X
>


<
gml
:Y
>
10gml
:Y
>


gml
:coord
>


<
gml
:coord
>


<
gml
:X
>
20gml
:X
>


<
gml
:Y
>
20gml
:Y
>


gml
:coord
>


gml
:Envelope
>


gml
:boundedBy
>


<
gml
:featureMember
>


<
Person
>


<
myns
:lastName
>
Smithmyns
:lastName
>


<
myns
:firstName
>
Fredmyns
:firstName
>


<
myns
:age
>
35myns
:age
>


<
myns
:sex
>
Malemyns
:sex
>


<
myns
:location
>


<
gml
:Point
>


<
gml
:pos
>
15 15gml
:pos
>


gml
:Point
>


myns
:location
>


<
myns
:mailAddress
>


<
myns
:Address
>


<
myns
:streetName
>
Main St.myns
:streetName
>


<
myns
:streetNumber
>
5myns
:streetNumber
>


<
myns
:city
>
SomeCitymyns
:city
>


<
myns
:province
>
Someprovincemyns
:province
>


<
myns
:postalCode
>
X1X 1X1myns
:postalCode
>


<
myns
:country
>
Canadamyns
:country
>


<
myns
:Address
>


myns
:mailAddress
>


Person
>


gml
:featureMember
>


wfs
:FeatureCollection
>

1.7.6. Transaction 操作

1.7.6.1. 1. KVP 格式请求

Transaction 操作使用 KVP 格式请求目前叧支持 Delete(Insert 和 Update 必须通过 XML 格式请求发送)。Transaction 操作需要以下的参数:

参数

是否必须

默认值

VERSION

1.1.0

SERVICE

WFS

REQUEST=Transaction

OPERATION=Delete

TYPENAME

RELEASEACTION

FILTER

BBOX

FEATUREID

以下是一个WFS使用KVP格式的Transaction操作示例:

http://www.someserver.com/wfs?

SERVICE=WFS&

VERSION=1.1.0&

REQUEST=Transaction&

OPERATION=Delete&

TYPENAME=InWaterA_1M,BuiltUpA_1M&

FILTER=(<Filter><Within><PropertyName>InWaterA_1M/wkbGeom<PropertyName>

<gml:Envelope>

<gml:lowerCorner>10 10</gml:lowerCorner>

<gml:upperCorner>20 20</gml:upperCorner></gml:Envelope></Within>

</Filter>)(< Filter><Within><PropertyName>BuiltUpA_1M/wkbGeom

<PropertyName><gml:Envelope><gml:lowerCorner>10 10</gml:lowerCorner>

<gml:upperCorner>20,20</gml:upperCorner>

</gml:Envelope></Within></Filter>)

1.7.6.2. 2.XML格式请求

以下是一个WFS使用XML格式的Transaction操作示例:

<?xml version="1.0" ?>

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

handle="Transaction 01" xmlns="http://www.someserver.com/myns"

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

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

xsi:schemaLocation="http://www.someserver.com/myns

http://www.someserver.com/wfs/cwwfs.cgi?

request=DESCRIBEFEATURETYPE&amp;

typename=ELEVP_1M,RoadL_1M,BuiltUpA_1M

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

<!--

Create a new instance of feature type RoadL_1M which has complex

properties segment and roadType.

-->

<wfs:Insert handle="ComplexInsert">

<RoadL_1M>

<name>Highway 401</name>

<segement>

<designation>SEG_A41</designation>

<geometry>

<gml:LineString gid="e3"

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

<gml:posList>...</gml:posList>

</gml:LineString>

</geometry>

</segment>

<roadType>

<surfaceType>Asphalt</surfaceType>

<nLanes>12</nLanes>

<grade>15</grade>

</roadType>

</RoadL_1M>

</wfs:Insert>

<!--

Update the designation of a particular range of segments which are now

being collapsed into a single segment. The The filter uses an XPath

expression to reference the designation property

-->

<wfs:Update typeName="RoadL_1M">

<wfs:Property>

<wfs:Name>RoadL_1M/segment/designation</wfs:Name>

<wfs:Value>SEG_A60</wfs:Value>

</wfs:Property>

<ogc:Filter>

<ogc:PropertyIsBetween>

<ogc:PropertyName>RoadL_1M/segment/designation</ogc:PropertyName>

<ogc:LowerBoundary>

<ogc:Literal>SEG_A60</ogc:Literal>

</ogc:LowerBoundary>

<ogc:UpperBoundary>

<ogc:Literal>SEG_A69</ogc:Literal>

</ogc:UpperBoundary>

</ogc:PropertyIsBetween>

</ogc:Filter>

</wfs:Update>

<!-- Delete the feature instance BuiltUpA_1M.1013. -->

<wfs:Delete typeName="BuiltUpA_1M">

<ogc:Filter>

<ogc:GmlObjectId gml:id="BuiltUpA_1M.1013" />

</ogc:Filter>

</wfs:Delete>

</wfs:Transaction>

1.7.6.3. 3.响应示例

以下是一个WFS的Transaction操作的响应示例:

<?xml version="1.0" ?>

<wfs:TransactionResponse 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 ../wfs/1.1.0/WFS.xsd">

<wfs:TransactionSummary>

<wfs:totalInserted>1</wfs:totalInserted>

<wfs:totalUpdated>1</wfs:totalUpdated>

<wfs:totalDeleted>1</wfs:totalDeleted>

</wfs:TransactionSummary>

<wfs:InsertResults>

<wfs:Feature handle="ComplexInsert">

<ogc:FeatureId fid="RoadL_1M.1553" />

</wfs:Feature>

<wfs:Feature handle="Statement 2">

<ogc:FeatureId fid="RoadL_1M.509876" />

</wfs:Feature>

<wfs:Feature handle="Statement 2">

<ogc:FeatureId fid="BuiltUpA_1M.509877" />

</wfs:Feature>

</wfs:InsertResults>

</wfs:TransactionResponse>

1.7.7. ArcGISServer对WFS的支持

ArcGISServer10中支持的WFS版本为最新的1.1.0。在ArcGISServer 中,叧需简单地勾选的Capabilities选项卡中可以选择支持WFS,如图 19。如果勾选了Transaction复选框,那么通过该WFS 还可以进行数据更新(注意,需要是SDE数据源)。

image0

图19ArcGISServer发布WFS服务

现在我们在浏览器中执行一个GetFeature操作,查询名为“Beijing”的对象:

http://localhost:8399/arcgis/services/test/wfsTest/MapServer/WFSServer?

request=getfeature&

typename=test_wfsTest:sde_cities&

filter=(

<ogc:Filter>

<ogc:PropertyIsEqualTo>

<ogc:PropertyName>CITY_NAME</ogc:PropertyName>

<ogc:Literal>Beijing</ogc:Literal>

</ogc:PropertyIsEqualTo>

</ogc:Filter>

)

这个操作返回如下的结果:

<wfs:FeatureCollection

xsi:schemaLocation='http://localhost:8399/arcgis/services/test/wfsTest/MapServer/WFSServer http://localhost:8399/arcgis/services/test/wfsTest/MapServer/WFSServer?request=DescribeFeatureType%26version=1.1.0%26typename=sde_cities http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd'

xmlns:test_wfsTest='http://localhost:8399/arcgis/services/test/wfsTest/MapServer/WFSServer'

xmlns:gml='http://www.opengis.net/gml' xmlns:wfs='http://www.opengis.net/wfs'

xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>

<gml:boundedBy>

<gml:Envelope srsName='urn:ogc:def:crs:EPSG:6.9:4326'>

<gml:lowerCorner>-86.002616990000007

-176.15156363599999</gml:lowerCorner>

<gml:upperCorner>102.93161888100001

179.22188769499999</gml:upperCorner>

</gml:Envelope>

</gml:boundedBy>

<gml:featureMember>

<test_wfsTest:sde_cities gml:id='F3__474'>

<test_wfsTest:OBJECTID>474</test_wfsTest:OBJECTID>

<test_wfsTest:CITY_NAME>Beijing</test_wfsTest:CITY_NAME>

<test_wfsTest:GMI_ADMIN>CHN-BJN</test_wfsTest:GMI_ADMIN>

<test_wfsTest:ADMIN_NAME>Beijing</test_wfsTest:ADMIN_NAME>

<test_wfsTest:FIPS_CNTRY>CH</test_wfsTest:FIPS_CNTRY>

<test_wfsTest:CNTRY_NAME>China</test_wfsTest:CNTRY_NAME>

<test_wfsTest:STATUS>National and provincial capital</test_wfsTest:STATUS>

<test_wfsTest:POP_RANK>1</test_wfsTest:POP_RANK>

<test_wfsTest:POP_CLASS>5,000,000 and greater</test_wfsTest:POP_CLASS>

<test_wfsTest:PORT_ID>0</test_wfsTest:PORT_ID>

<test_wfsTest:LABEL_FLAG>1</test_wfsTest:LABEL_FLAG>

<test_wfsTest:NEAR_FID>40</test_wfsTest:NEAR_FID>

<test_wfsTest:NEAR_DIST>185.74736243999999</test_wfsTest:NEAR_DIST>

<test_wfsTest:Shape>

<gml:Point>

<gml:pos>39.906189088000019 116.38803663600004</gml:pos>

</gml:Point>

</test_wfsTest:Shape>

</test_wfsTest:sde_cities>

</gml:featureMember>

</wfs:FeatureCollection>

接着,我想删掉这个对象,就要使用Transaction操作。在ArcGISServer 中,执行删除之前还需要lockId属性,因此还需要通过GetFeatureWithLock 操作获取一个锁:

http://localhost:8399/arcgis/services/test/wfsTest/MapServer/WFSServer?

request=getfeaturewithlock&

typename=test_wfsTest:sde_cities&

filter=(

<ogc:Filter>

<ogc:PropertyIsEqualTo>

<ogc:PropertyName>CITY_NAME</ogc:PropertyName>

<ogc:Literal>Beijing</ogc:Literal>

</ogc:PropertyIsEqualTo>

</ogc:Filter>

)

这个操作返回lockId值为"{CEBC222E-00AD-49F5-A0E9-9F4CB98EE07E}",接下来,我们通过一个POST请求对这个对象进行删除,请求体内容如下:

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

xmlns="http://www.someserver.com/myns"

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

xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<wfs:LockId>{CEBC222E-00AD-49F5-A0E9-9F4CB98EE07E}</wfs:LockId>

<wfs:Delete typeName="test_wfsTest:sde_cities">

<ogc:Filter>

<ogc:GmlObjectId gml:id="F3__474" />

</ogc:Filter>

</wfs:Delete>

</wfs:Transaction>

删除成功后将会返回如下的结果:

<wfs:TransactionResponse version='1.1.0'

xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:gml='http://www.opengis.net/gml'

xmlns:ogc='http://www.opengis.net/ogc' xmlns:wfs='http://www.opengis.net/wfs'>

<wfs:TransactionSummary>

<wfs:totalDeleted>1</wfs:totalDeleted>

</wfs:TransactionSummary>

</wfs:TransactionResponse>

我们也可以在其它的客户端中直接加载这个WFS服务,比如使用uDig:

image1

图20uDig中加载ArcGISServer发布的WFS服务

18

OGC Common Query Language,参考《OGC Catalogue Service 2.0.2》标准的 6.2 章节。