AnsweredAssumed Answered

Recommended pattern for updating layer data

Question asked by ywen123 on Dec 18, 2017
Latest reply on Aug 6, 2018 by rscheitlin

Background: My map is created by instantiating feature layers via the API.  I'm not interfacing with an ArcGIS MapServer directly.


For my map's layers, I have a need to update the attributes associated with each geometry in the layer.  The reason is the attribute data determines the color of each geometry's symbol.  So imagine an update mechanism that gets the latest attribute values from the server.


Right now, I have a fairly crude async timer that periodically does the following actions to remove existing layers, and then instantiates new layers using the updated data (layersData);


While this works, I end up with a quick flash of the plotted symbols whenever the layers get removed and re-added.  Is there another pattern allowable by the JS API that allows more seamless update/replacement of active layers?


One thing to note, the plotted graphics may not all have unique ids.  So this makes a delta detection approach problematic.  I basically just want a way to replace the existing layers with new layers, without a UI reflow of the empty layers state.  Thanks