refreshData: function(data) { this.clear(); this._clusterData = data; this._clusterGraphics(); },
I understand, that's a slightly different issue. The cluster layer as-is expects all data initially and isn't set up to have new data continuously pushed in. One option would be to remove the cluster layer, destroy it and then create a new cluster layer when new data is available. It might also be possible to re-cluster on the fly, but I haven't looked at that code in a while so I'm not certain that re-clustering would be easy without changing some of the cluster layer's methods.
The clusters are regenerated when I change my map's zoom level. My issue lies in having a new query result. For example, in my map, the user can enter the name of a species and the query task will come back with those results clustered. If the user enters a new query for a different species, the results come back but they aren't being displayed at all ... not as clusters or anything else. The old cluster results are still being displayed on the map.
The cluster layer should be handling this for you, meaning that you shouldn't have to manually manage cluster graphics. Clusters should be removed and regenerated when the map's zoom level changes. Is that not working for you?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.