cmv/cmv-app

Dynamic Map Service Features Count

durga-pericherla opened this issue · 3 comments

Hello, I am using the CMV for the assets management. So I wanted to display the count of the assets that are displayed on the map which is nothing but count of the features of each layer(Point type) of a Dynamic Map service on top of the CMV. I also wanted to show the count of that layer when the layer is turned on and hide the count automatically when it is turned off. Is there any solution for this/Can any one guide me how to do it.

Thanks in Advance.

You essentially want to execute the queryCount method for each feature layer in your dynamic map service. The query that you pass to queryCount can be constructed to pass in the current map extent as the query's geometry property, applying a spatial filter to only count those shown in the map.

You can attach the function to construct these queries to the visibility-change event of the dynamic map service layer (to toggle executing the queries and displaying the results on/off as the map service layer is toggled), and probably the update-end event, so that it updates the count after it's redrawn (say in response to panning/zooming the map).

@ParkShinYoo The steps that @wmbeers suggested are right on track. I would suggest this is best done in a custom widget that displays the feature counts - possibly in a dgrid or table in a TitlePane widget.

Thanks @wmbeers @tmcgee , I will try to create a new widget that displays feature count based on the layers on/off .