Select to view content in your preferred language

FeatureLayer slow on Update()

2078
4
06-22-2011 04:12 AM
ChrisSmith
Emerging Contributor
Hi

I have a FeatureLayer of approx 4000 points, if I apply a polygon to the Geometry property of the FeatureLayer and then call Update() on the FeatureLayer performance is very slow it takes considerable time before the rest call is even issued.

After digging again in Reflector I spotted a method called clearGraphicsNoDelete() that iterates through the Graphics collection and does a RemoveAt() method call and this appears to be the culprit for slowing the spatial query/Update() down.

If I call layer.Graphics.Clear() before calling Update() the update takes considerably less time, basically I want to know if this will have any adverse affect on the FeatureLayer ( The layer is a readonly view of data) OR am I using the FeatureLayer incorrectly?

Thanks

Chris
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
You might want to consider using OnDemand or SelectionOnly mode. I suspect you don't display all 4000 points? http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...

If FeatureLayer is read-only, why do you change Geometry and call Update()? Maybe you don't need to call Update() every time the client makes a change? I think of Update() as the client's means of getting latest data from the server.
0 Kudos
ChrisSmith
Emerging Contributor
Hi Jennifer

Thanks for the response.

Yes the requirement is to display all the points on the map, the locations are spread across the world and the startup view is a world view with the points displayed using a class breaks renderer.

The data is 'read only' as in the user is not editing, the update is called because the user can apply any number of attribute filters and a spatial filter.

Regards

Chris
0 Kudos
ChrisSmith
Emerging Contributor
Have created a test app that excludes all of my project code, from this it appears that the issue only occurs when the FeatureLayer is bound to a FeatureDataGrid.
0 Kudos
ChristopherHill
Deactivated User
The easiest way to get around this performance problem at the moment would be to remove the binding to FeatureDataGrid.GraphicsLayer just before calling Update, then on FeatureLayer.UpdateCompleted rebind the FeatureLayer to FeatureDataGrid.GraphicsLayer . What is happening is the FDG is calling 4,000 delete row calls and when your resutls comes back with lets say for example 2,000 graphics. FDG will call 2,000 add row events. unhooking from the feature layer will call 1 event to remove 4,000 then rehooking will raise 1 event to add 2,000. We already have an idea of how we can imporove the FeatureLayer and FeatureDataGrid so that it will perform better, so we will be looking into improving this performance problem.
0 Kudos