wfs 空间操作是真的繁琐,参数也是必须要完整对应每次都记不住,授人以鱼不如授人以渔,这里记录下具体参数设置过程吧
1.找到需要插入数据的空间表
2.获取对应工作区url
3.找到对应的例子区域
-- 这里以空间数据插入为例
4.找到xml数据替换对应的参数
<wfs:Transaction service="WFS" version="1.0.0"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:cite="http://www.opengeospatial.net/cite"
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-transaction.xsd http://www.opengeospatial.net/cite http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=cite:polygon">
<wfs:Insert>
<cite:polygon>
<cite:geom>
<gml:MultiPolygon srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates xmlns:gml="http://www.opengis.net/gml" decimal="." cs="," ts=" ">93.64746094,37.10776507 93.01025391,35.17380832 95.11962891,33.54139467 97.53662109,33.54139467 99.25048828,33.96158629 99.97558594,35.19176697 99.84375,36.38591277 98.85498047,37.4574181 97.18505859,37.90953362 95.16357422,37.82280243 93.64746094,37.10776507</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</cite:geom>
<cite:userid>666</cite:userid>
</cite:polygon>
</wfs:Insert>
</wfs:Transaction>
5.找到对应的矢量数据写法
就在这矢量数据
6.最后你要查询数据是否插入成功
http://localhost:8080/geoserver/cite/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=cite%3Apolygon&maxFeatures=50&outputFormat=application%2Fjson