Update FeatureLayer without using Update()

519
1
09-28-2011 08:59 AM
BenSher1
New Contributor
I am referencing a USGS Feature Layer and want the map to show the new features when new features are added to the service. How can I handle this without using a ticker and calling Update() on the FeatureLayer, which in return does a full refresh of the layer.

I tried implementing the code from the blog, but I get an error.

http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/01/23/Listen-for-updates-to-a-FeatureLay...
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor
Instead of FeatureLayer, use a GraphicsLayer + a QueryTask, and add the features to the graphics layer that return from the QueryTask. In your update method, you then set a where clause that specifies the added/modified date to be newer than any features you already have. Ie something along the lines of:
query.Where="LastUpdated>'"+(from a in layer.Graphics select ((DateTime)a.Attributes["LastUpdated"])).Max().ToString() + "'";
0 Kudos