basemap = new esri.layers.ArcGISTiledMapServiceLayer(basemapURL); map.addLayer(basemap); kml = new esri.layers.KMLLayer(kmlUrl); map.addLayer(kml); dataLayer = new esri.layers.GraphicsLayer(); map.addLayer(dataLayer);
When I print the layer.id for each I get the following: dataLayer = graphicsLayer2 kml = layer1 basemap = layer0
I want my dataLayer to be the top layer but it seems no matter what I do the kml layer is on top. I tried reorderLayer and put the graphics layer in index 2 and still same result. How can I display the real order of all layers in a map and get my dataLayer on top?
Are there any plans to correct this behavior? It seems like a bug to me. I need to support an arbitrary number and ordering of KML layers. I suppose I could devise a method for doing the post-load reordering, but it would be nice not to have to... 🙂
Another thing that would be nice is a way to control the naming of the graphics layers that get created. We use the layerId's to display in a feature navigation widget, and it's confusing to see graphicsLayer8, etc. show up there. Is this possible or will it mess up the parentLayer.Refresh() functionality?