Cluster of 50,000 Points, dynamically add/remove cluster

6094
6
04-11-2011 09:26 AM
RyanCoodey
Occasional Contributor III
Ok, I know a am pushing the limits here with 50,000 points, but what we would like almost works...

These 50,000 points spread across different areas in California, but some points are pretty close together, within feet.  So the initial extent of the map is zoomed out to roughly the California area, the AGS service is set to return up to 75,000 points, and the FeatureLayer is setup as this:
<esri:FeatureLayer ID="Well" Url="http://bkgis02/ArcGIS/rest/services/Global/Well-FeatureLayer/MapServer/0" Mode="OnDemand" OnDemandCacheSize="75000" OutFields="WELL_NME,WELL_API_NBR">
     <esri:FeatureLayer.MapTip>
          ...          


Since it is loading all these points initially, I figured I might as well cache them all... it takes about 10 seconds to load all the points and create the initial cluster (I give the user a progress bar).  First question, is this a bad idea?  I am ok with this one time initial wait...

Once loaded, the cluster works good, as I zoom in and pan around it responds pretty quickly... But since some of these points are pretty close, when the extent gets pretty far in, I would like to drop the cluster.  I have tried this in two ways:

Option 1:
        void Map_ExtentChanged(Object sender, ExtentEventArgs e)
        {
            FeatureLayer featureLayer = ((FeatureLayer)Map.Layers[7]);
            if (Map.Resolution > 2)
            {
                if (featureLayer.Clusterer == null)
                    featureLayer.Clusterer = flareClusterer;
            }
            else
                featureLayer.Clusterer = null;
        }


Option 2:
        void Map_ExtentChanged(object sender, ExtentEventArgs e)
        {
            if (Map.Resolution > 3)
                Clusterer.Radius = ClusterRadius;
            else
                Clusterer.Radius = 1; //Radius 0 doesn't work
        }


I like option 1 the best and it works really good except for one issue, which option 2 has this same issue too.  Zooming in works great, panning works great, but zooming out causes the application to hang.  I think the problem lies that when zooming out, the Map is now trying to render thousands of feature points, and it is doing this before the cluster has been set...

Any ideas?  Am I missing something simple here?  A great feature enhancement would be to add a MinimumResolution to Clusters (I might add this in the beta community)...

Also, I tried using ExtentChanging instead of ExtentChanged... and this does fix the above issue, but it is causing any panning and zooming to lag too much then... *EDIT* I tweaked the code a bit to make this more efficient, but still seems like overkill

Thanks a lot for any help!!!

*EDIT* Also, Another issue... while the cluster refreshes real fast, and so do the ESRI imagery tiled layers, the maps progress bar seems to hang... and so does the refreshing of other ArcGISDynamicMapServiceLayers (mostly when zooming out)
6 Replies
dotMorten_esri
Esri Notable Contributor
Perhaps you can do it on the ExtentChanging event instead? That would trigger before the reclustering and rendering happens.
However, flipping that switch on and off all the time could be a slight perf hit as well. You could also turn the visibility off when you hit the threshold during the ExtentChanging event, then set the clusterer when ExtentChanged fires, and turn the layer back on.

I would say this though: 50.000 is a lot to ask the user to download. I doubt the user really needs to hover on all 50.000 elements.
I talked a bit about alternative approaches in this session: http://resources.arcgis.com/gallery/video/arcgis-api-for-silverlightwpf/details?entryID=E50439B8-142...  (26:30 mins in)
0 Kudos
RyanCoodey
Occasional Contributor III
Hey Morten,

Thanks a lot for that reply.. The ExtentChanging works... and you are right the user does not need all 50,000 points, BUT, what they do need is an accurate count of points that are contained in the cluster, and this is not possible without downloading all the points, right?  If it is not downloaded, then it is not counted in the cluster...

And the initial extent of the map will cover the area of all 50,000 points, and the users would like to see this cluster at this extent.

But as far as the features go, they do not need to see them until zoomed way in, and "OnDemand" is perfect for this.  Also, the "on demand map tip" you showed off will be great too.  I was actually at this DevSummit session and that plus several user requests have inspired us to move from a dynamic service layer to a feature layer with map tips and clustering :).

This data really fits the clustering concept well, would be nice if the cluster could be generated server side.

Thanks a lot for the help!  And that great DevSummit session�?� please let me know if you have any more ideas.
0 Kudos
suhanatssuhanats
New Contributor
can i do the same with more than several million and growing points?
0 Kudos
bdv_works
New Contributor

we did this through server-side clustering solutions, please check out the link:

http://www.bdvengine.info:8080/bdvengine/BDV_Demo.html

0 Kudos
veenahosur1
New Contributor II

i have 60 lac points how can i display cluster

0 Kudos
DidarBultanov
New Contributor II

if (MyMap.Scale >= 6000000)

                {

.......

}

else if (MyMap.Scale <= 6000000 && MyMap.Scale >= 500000)

                {

.........

}

else if (MyMap.Scale < 500000)

                {

....................

}

http://infopublic.pravstat.kz:8399/crime-map/

0 Kudos