AnsweredAssumed Answered

jimu layerStructure and layer.hide()/layer.show() - Calls to ArcGIS Server

Question asked by agelfert on Oct 8, 2020

Working in the world of custom WAB development using JSAPI 3.x, and looking at some performance tweaks.

 

Notice that when I use the following approach to update multiple layers' visibility, it takes a long time to update the map...

layerStructure.traversal(function(layerNode) {
//...
   layerNode.hide()
//or
   layerNode.show()
//...
})

What I see in Chrome Dev Tools is that for each pass through and layer for which visibility is updated, there is a call to server that returns a new PNG. I guess that makes sense. So we're waiting for the last of multiple images to be available before the update of the map is reflected in the browser. Is there a way to somehow redesign this to where I can make all my update before the call to the server happens and then receive one PNG?

 

On on only remotely related note, it says here ( Feature Layer Best Practices | Guide | ArcGIS API for JavaScript 3.33) that for JSAPI 2.6 and later feature generalization (using maxAllowableOffset) is the default. Does that also apply for any layers in Web AppBuilder? If I have a a webmap that includes a layer with rather complex polygons, is it by default using generalization when zooming in/out, and if not, how can I leverage maxAllowableOffset?

 

Thanks!

Outcomes