sjacksonesriaustralia-com-au-esridist

Get feature-count from a cached service for current extent?

Discussion created by sjacksonesriaustralia-com-au-esridist Employee on Dec 3, 2012
Latest reply on Dec 10, 2012 by derekwaynemiller
I have one points layer in a cached map service, symbolised with a unique value renderer on one field.
e.g. petrol stations, symbolised by the company who owns them.

One of the main (and only) components I need, is a dynamic legend, that shows a feature count for the current extent.
e.g. Shell - 34, BP - 21, Texaco - 7, etc

I should point out that this is a cached service for a reason.  Theres a lot of points, and they need to be visible at all times (clustering/heat maps not an option). At full extent, your looking at nearly 80k points.

With this in mind, I need to find out a count for features in the layer, broken down by the unique value renderer, with the current extent as a bounding box.

Has anyone seen any code that could get me started on this or can provide some references/pseudocode on how one would go about this?

Or perhaps I am not being realistic, and it will not be responsive enough?

The actual idea I have in mind, is to have a vertical chart for the 5 types of petrol station.
This chart changes as the extent changes, pending how many total features are in the current extent.
This chart will serve as both a legend (as the 5 types are 5 distinct coloured points) and provide an idea of how the totals are different in different regions.

Outcomes