[GIS] GeoExt Legend Modification To Include Feature Count

geoextgeoserveropenlayers-2wfswms

GeoExt has Legend capability but is is quite basic which shows only feature types like in example http://api.geoext.org/1.0/examples/legendpanel.html. How could it be modified display legend with count(no of values)?

enter image description here

I am using geoserver to serve map and using geoext.

The solution I am looking for is to add this feature into legend panel (may be through modification of javascript source) and not make my own solution. Any path, direction code for this would be appreciated.

Best Answer

To get the number of features from a layer in the server you need to use the WFS (Web Feature Service) request. You will need to call GetFeature and set the parameter resultType to hits (resultType=hits). This will just give you an integer count of the number of features you've requested (as opposed to returning all the features, as a GetFeature request using resultType=results would).

Related Question