Select to view content in your preferred language

On Demand Loading on graphic layer

1908
4
04-08-2012 01:59 AM
AYOOLAOLOJEDE
Deactivated User
Please how can i implement on demand loading of points (with graphics) on graphic layers as i have close to 20,000 points since i am not using featuredlayers. Thanks
0 Kudos
4 Replies
JoshPorter
Occasional Contributor
Yes I also have a vast amount of datapoints to display, and looking for advice on how to do this. I am migrating our C1 map to an ESRI map.  I set up clustering which is great, but when zooming in, things get slow. I noticed in this sample, http://www.arcgis.com/rc/item.html?id=67f62c5c30cc4b3ca942068e404c442c, things on the map are only drawn for the area shown, and then when the map is panned, some layers get redrawn, showing data for the visible area.
The datapoints we are plotting correspond to real-time data, so caching doesn't seem to be an option.
Cheers
0 Kudos
JenniferNery
Esri Regular Contributor
FeatureLayer inherits from GraphicsLayer. One major difference is that FeatureLayer has a QueryTask built-in, which allows this layer to have a Mode. This is an example of Mode=OnDemand in FeatureLayer: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerOnDemand. If you have Fiddler open, you will notice that query is sent everytime map extent changes. This means features are cached/added on client when they become visible in the current map extent. This concepts page might help: http://help.arcgis.com/en/webapi/silverlight/help/index.html#/Feature_layers/016600000015000000/
0 Kudos
JoshPorter
Occasional Contributor
Currently I have something using a GraphicsSource much like http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#UsingGraphicsSource .
Do you know of a way to load onto the map only what is visible in the current extent?  We do not have the ability to create and host a service, but maybe we could make a local table with this data and pass it to the feature layer to use. Thanks for helping a newbie out 🙂
The end goal of all this is to get the datapoints on the map without encountering unreasonable performance issues.
Josh
0 Kudos
dotMorten_esri
Esri Notable Contributor
Generally the GraphicsLayer/Map can handle all 20,000 points with no problem. However, displaying all of these at once is a problem.
In other words, when you are zoomed in on the map and can only see for instance 100 of the 20000 points that are in the layer, you should see good performance. However if you zoom out to a place where all 20,000 points are visible, you are going to see a performance hit. So basically the performance hit is not about how many points a layer has, but about how many of them are currently visible at a given time.

So generally what I recommend is to set the MaxResolution property on the layer to turn off the layer when zoomed out beyond a certain scale. That way you don't really have to worry about building your own on-demand framework on GraphicsLayer.

If you want an on-demand implementation you would have to rely on the Map.ExtentChanged event to add/remove features to/from the graphicslayer based on the current map extent.
0 Kudos