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