I have one points layer in a cached map service, symbolised with a unique renderer on one field.
e.g. petrol stations, symbolised by the company who owns them.

I want to create a fairly basic application in the Esri Javascript API (or potentially with the Google Maps API, and this).

One of the main components I need to have on this application is a dynamic legend that shows a feature count for the current extent.
e.g. Shell - 34, BP - 21, Texaco - 7, etc

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?


We did this using a query task to get a list of unique ID's for each point on the client, then passed these values to a back end REST handler created with WCF. The handler queried an SQL database to get the counts based on those UID's, returning to the client for display. It worked very well and perfomance in refreshing the counts was very good.

| improve this answer | |
  • Out of interest, how many points were being returned? I have realised that I have a lot of points and this might lead to an unresponsive component. – Simon Dec 3 '12 at 12:36
  • 1000 points are often returned. Since 1000 is the default limit of the query (and we didn't change this) a maximum of 1000 can be calculated for any given display. – David Wilton Dec 3 '12 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.