Please correct me if I'm wrong:
Assume gLayer is a graphic layer and flayer is a feature layer.
If I call map.reorderLayer(gLayer, 0), I will only be reordering the map.graphicLayerIds collection where 0 is the going to appear under any other graphic layer.
If I call map.reorderLayer(fLayer, 1), I will be reordering all other layers where 1 will be just on top of the basemap but appear under all other layers.
Right?
Is there a way to reorder all layers at once? It appears that graphic layers will always appear on top of other layers.
Is there a way to send a specific layer all the way to the front (appear on top of everything)? If 0 is the basemap, and 1 is the first layer added... how can I reorder a layer to be set to the front if don't know how many total layers there are? I know how many graphic layers, and I know how many other layers there are. Ideally, if I have 5 layers on the map (including the basemap), I would want to call map.reorderLayer(fLayer, 4).
I haven't found a good way to manage the appearance order of all graphics. Must I order graphic layers and all other layers separately?
Thoughts?
Thanks!
When I want to have a layer draw on top, I've used:
var numLayers = map.layerIds.length -1
map.reorderLayer(myLayer, numLayers);
It seems like you ought to be able to find the number of graphicsLayers, adding it numLayers to make a sum total, then reorder the layer to be at the very top.
I haven't tested this, though.
I was partially wrong in my explanation. FeatureLayers are graphic layers, aren't they? Or, they at least show up as graphicLayerIds? These can be reordered with graphicLayerIds from a draw tool (assuming you put them in a layer).
The problem is that you cannot hide a graphic layer under another layer type. You can reorder all day long to max-1 but the graphic layers will always be on top. That's the problem.
This is something that is changed in 4.x API
I know.
But I'm in 3.14, soon to be 3.15.