Select to view content in your preferred language

How to get layer orders displayed and layers in proper order

10055
11
Jump to solution
01-12-2012 05:19 AM
DanRicketts
Deactivated User
I am adding three layers to a map in this order:

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?
0 Kudos
11 Replies
DanielWalton
Frequent Contributor
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... 🙂
0 Kudos
DanielWalton
Frequent Contributor
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?
0 Kudos