Similar ESRI arcgis.com can anyone give pointers on how to move layer up/down? And if possible include the context menu.

Using JavaScript API

  • What platform are you working with: javascript or Silverlight? – Dan Walton Mar 8 '11 at 14:52

You can use the map's reorderLayer() method.

Changes the layer order in the map. Note that the first layer added is always the base layer, even if its order is changed.

reorderLayer(layer, index)

The index refers to the location for placing the layer. The bottom most layer has an index of 0.

something like:


for more information check the esri.Map class in the API Reference here: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm


The client-side APIs treat each map service as a layer, while the map service itself may also contain layers (as defined in your MXD, for example). If you are asking about layers within an ArcGIS Server map service, it cannot be done as AGS does not support it.

  • @ nw1: Erm are you sure about your statement? The link in my OP for ESRI.com does exactly what I'm looking to do, just want to know if anyone knows how they went about it. Thanks for your response anyway. – blueRace Mar 10 '11 at 9:18
  • is correct. You need to differentiate between map services and service layers. within the framework of the javascript API you cannot manipulate the layers of a service, you can only do this from the mxd. In the javascript API, however, each service added is treated essentially as a layer which can be manipulated as mentioned above by using the reorder method or the order in which the services are added. – badkins Apr 9 '11 at 8:11
  • Maybe, it wasn't supported back then but now you can reorder layers within map service: developers.arcgis.com/javascript/jssamples/… – Matej Jul 3 '14 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.