Answers:
您可以将参数resultType设置为“ hits”,您将在查询中获得与SQL中的count()函数相似的功能数量。
HTTP Get请求示例:
http://localhost:8080/geoserver/wfs?request=GetFeature&typeName=topp:states&version=1.1.0&resultType=hits
带有过滤器的HTTP Post请求示例:
<wfs:GetFeature service="WFS" version="1.1.0"
resultType="hits"
xmlns:topp="http://www.openplans.org/topp"
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="topp:states">
<ogc:Filter>
<ogc:FeatureId fid="states.3"/>
</ogc:Filter>
</wfs:Query>
</wfs:GetFeature>