In JSAPI 3.17, reordering a MapImageLayer seems to have no effect. I am calling map.reorderLayer(mapImageLayer,layerOrder) where layerOrder is a number and mapImageLayer is a MapImageLayer | API Reference | ArcGIS API for JavaScript 3.17
It always wants to put the layer at position 1 right above the basemap.
Any workarounds?
Marc,
The way the JS API 3.x is built layer order is confined to this order
I thought I could find a reference to this somewhere in the API Docs but I cant seem to now.
This is based on the internal workings of the API and the fact that graphics and featurelayers are drawn using SVG verses basemap, tiled, dynamic use a image returned from the server.
I seem to recall someone having a semi workaround (maybe you Robert?), or more of a trick.
Create a custom basemap that basically has nothing on it or is very transparent. Then use you layer. If you need the "basemap" features on top, just have it as another tiled layer.
This is untested by me, so no other suggestions.
Yes, you can do that with Basemap and BasemapLayer. By setting the isReference = true will make the layer to be visible on top of all the other layers. checkout the constructor parameters for BasemapLayer
BasemapLayer | API Reference | ArcGIS API for JavaScript 3.17
Set to true if the layer is a reference layer and should be drawn on top of all other layers in the map.
I've created a dialog for reordering layers, and guess I will need to disable MapImageLayers if they can't be reordered.
Why u dont try adding the mapimagelayer as a normal layer with:
map.addLayer(myImgLayer, position);