Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

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.

share|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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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