stevengriffith

Bug in Adding Layers to Map?

Discussion created by stevengriffith on Mar 22, 2013
I'm calling the API method to add multiple layers to a map, and passing in an array consisting of my base and dynamic map layers. I'm also monitoring the event "OnLayersAddResult" to catch when all the layers are fully added. What's apparently happening is that the event is being fired before the last layer is fully complete, and the results array returned to the callback function has a fairly serious oddity.

Say my array of layers has layers ["A", "B", "C", "D", ...]. I pass this array of layer objects to map.addLayers(). The Event "OnLayersAddResult" fires and my callback function is called. However, the "results" variable passed to my callback function has the layers listed as ["A", "A", "B", "C", "D", ...], and the last entry in my input layer array is missing. That last layer is also incomplete - the layerInfo objects are not populated at this point in time, but are once the web page fully loads.

What's interesting is that this only appears to happen if the base layer (the first entry, "A") is an Open Street Maps layer (esri.layers.OpenStreetMapLayer), but not if the base layer is an esri.layers.ArcGISTiledMapServiceLayer.

Steve G.
County of SLO

Outcomes