geoserver wfts服务post操作测试记录
2019-10-13 本文已影响0人
一个前端程序员
测试地址:http://192.168.0.250:8080/geoserver/test/wfs
相关资料:wfst相关文档
1、GetCapabilities请求
var xml = `
<?xml version="1.0" ?>
<GetCapabilities
service="WFS"
version="1.0.0"
xmlns="http://www.opengis.net/wfs" />`
2、DescribeFeatureType
var xml =
`<?xml version="1.0" ?>
<wfs:DescribeFeatureType
service="WFS"
version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:myns="http://www.example.com/myns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd">
<wfs:TypeName>test:point</wfs:TypeName>
</wfs:DescribeFeatureType>`
wfs要数查询
3、GetFeature
var xml =
`<?xml version="1.0" ?>
<wfs:GetFeature
service="WFS"
version="1.0.0"
outputFormat="json"
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.0.0/WFS-basic.xsd">
<wfs:Query typeName="polygon">
<ogc:Filter>
<ogc:FeatureId fid="348" />
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>`
wfst服务Transaction 事物操作
4、Insert
var xml =
`<?xml version="1.0" ?>
<wfs:Transaction
version="1.0.0"
service="WFS"
xmlns:opengis="http://www.cetusOpengis.com"
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.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Insert>
<point>
<geom>
<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4546">
<gml:coordinates decimal="." cs="," ts=" ">571430.01881945,3825040.98040829</gml:coordinates>
</gml:Point>
</geom>
<xzqmc>qwe</xzqmc>
</point>
</wfs:Insert>
</wfs:Transaction>`
5、Update
var xml =
`<?xml version="1.0"?>
<wfs:Transaction
version="1.0.0"
service="WFS"
xmlns:opengis="http://www.cetusOpengis.com"
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.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Update typeName="point" >
<wfs:Property>
<wfs:Name>xzqmc</wfs:Name>
<wfs:Value>测试更新413</wfs:Value>
</wfs:Property>
<ogc:Filter>
<FeatureId fid="413" />
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>`
6、Delete
var xml =
`<wfs:Transaction
service="WFS"
version="1.0.0"
outputFormat="GML2"
xmlns:opengis="http://www.cetusOpengis.com"
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.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
<wfs:Delete typeName="point">
<ogc:Filter>
<ogc:FeatureId fid="413" />
</ogc:Filter>
</wfs:Delete>
</wfs:Transaction>`