1、cql查询示例,根据点查询返回code的空间查询示例
http://192.168.0.226:8080/geoserver/lgum/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=lgum:jd&cql_filter=CONTAINS(geom%2cPOINT(114.23859+22.68015))&maxFeatures=1&propertyName=JDCODE&outputFormat=json
根据坐标查询单元网格编码
http://192.168.0.226:8080/geoserver/lgum/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=lgum:grid&cql_filter=CONTAINS(geom%2cPOINT(114.23859+22.68015))&maxFeatures=1&propertyName=GRIDCODE&outputFormat=json
2、根据WFS更新图层属性
请求的URL:
http://192.168.0.228:8080/geoserver/wfs
POST XML参数值
<!-- YOU PROBABLY DO NOT WANT TO RUN THIS QUERY SINCE
IT WILL MODIFY YOUR SOURCE DATA FILES This will update the type field for the tasmania_roads dataset. --> <wfs:Transaction service="WFS" version="1.0.0"
xmlns:topp="http://www.openplans.org/topp"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wfs="http://www.opengis.net/wfs">
<wfs:Update typeName="baum:sq_baidu">
<wfs:Property>
<wfs:Name>MC</wfs:Name>
<wfs:Value>罗田社区_new</wfs:Value>
</wfs:Property>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>TYDZBM</ogc:PropertyName>
<ogc:Literal>440306004009</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>
更新图层时,遇到is read-only的解决方法:
打开geoserver管理界面,点击左侧的“”Security“”中的“”Data“”栏,点击“Rule path”中的“..w”,勾选“Grant access to any role”下面的单选框,点击保存,清理缓存,再是修改后点击提交,保存成功。