Skip to content

Instantly share code, notes, and snippets.

@SKalt
Last active June 27, 2024 01:15
Show Gist options
  • Save SKalt/0f4b757209687331c8a1d40aecbf69f9 to your computer and use it in GitHub Desktop.
Save SKalt/0f4b757209687331c8a1d40aecbf69f9 to your computer and use it in GitHub Desktop.
WFS-T 2.0.0 example requests
<?xml version="1.0" ?>
<wfs:Transaction
version="2.0.0"
service="WFS"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0/wfs.xsd">
<wfs:Delete typeName="topp:tasmania_roads">
<fes:Filter>
<fes:ResourceId rid="tasmania_roads.14"/>
</fes:Filter>
</wfs:Delete>
</wfs:Transaction>
<?xml version="1.0"?>
<wfs:Transaction
version="2.0.0"
service="WFS"
xmlns:topp="http://www.openplans.org/topp"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0/wfs.xsd
http://www.opengis.net/gml/3.2
http://schemas.opengis.net/gml/3.2.1/gml.xsd">
<wfs:Insert>
<topp:tasmania_roads gml:id="tasmania_roads.13">
<topp:the_geom>
<gml:MultiCurve srsName="http://www.opengis.net/def/crs/epsg/0/4326">
<gml:curveMember>
<gml:LineString>
<gml:posList>-146.46 -41.24 146.57 -41.25 146.64 -41.25 146.76 -41.33</gml:posList>
</gml:LineString>
</gml:curveMember>
</gml:MultiCurve>
</topp:the_geom>
<topp:TYPE>RnbwRd</topp:TYPE>
</topp:tasmania_roads>
<!-- you can insert multiple features if you wish-->
</wfs:Insert>
<fes:Filter>
<fes:ResourceId rid="tasmania_roads.13"/>
</fes:Filter>
</wfs:Transaction>
<wfs:Transaction
version="2.0.0"
service="WFS"
xmlns:topp="http://www.openplans.org/topp"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0/wfs.xsd">
<wfs:Replace>
<topp:tasmania_roads gml:id="tasmania_roads.15">
<topp:the_geom>
<gml:MultiCurve srsName="http://www.opengis.net/def/crs/epsg/0/4326">
<gml:curveMember>
<gml:LineString>
<gml:posList>-146.46 -41.24 146.57 -41.25 146.64 -41.25 146.76 -41.33</gml:posList>
</gml:LineString>
</gml:curveMember>
</gml:MultiCurve>
</topp:the_geom>
<topp:TYPE>FuryRd</topp:TYPE>
</topp:tasmania_roads>
<fes:Filter>
<fes:ResourceId rid="tasmania_roads.13"/>
</fes:Filter>
</wfs:Replace>
</wfs:Transaction>
<?xml version="1.0" ?>
<wfs:Transaction
version="2.0.0"
service="WFS"
xmlns:fes="http://www.opengis.net/fes/2.0"
xmlns:wfs="http://www.opengis.net/wfs/2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wfs/2.0
http://schemas.opengis.net/wfs/2.0.0/wfs.xsd">
<wfs:Update typeName="topp:tasmania_roads">
<wfs:Property>
<wfs:ValueReference>TYPE</wfs:ValueReference>
<wfs:Value>YllwBrk</wfs:Value>
</wfs:Property>
<fes:Filter>
<fes:ResourceId rid="tasmania_roads.14"/>
</fes:Filter>
</wfs:Update>
</wfs:Transaction>

WFS-T 2.0.0 examples

Here I've translated the geoserver Web Feature Service Transactions (WFS-T) 1.0.0 examples into WFS-T 2.0.0 xml. All of these have been verified to work on geoserver 2.11.

Additional resources

action docs examples
delete docs examples
insert docs examples
replace docs example
update docs examples

More WFS-T examples can be found at schemas.opengis.net/wfs/2.0/examples/Transaction/ .

Transaction results xml [docs][example].

Filter Encoding Specificatons (fes) for WFS-T 2 can be found at docs.opengeospatial.org.

The WFS 2.0 xml schema can be found at http://schemas.opengis.net/wfs/2.0/wfs.xsd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment