AnsweredAssumed Answered

JS API: reorder layers with a tiled reference layer

Question asked by ambell_dev on Jul 31, 2015
Latest reply on Jul 31, 2015 by rscheitlin

I'm trying to add a reference layer from a tiled map service to be above a polygon feature layer with the ArcGIS JavaScript API. I tried using map.reorderLayer() to change the layer order but the reference layer is still showing up below the polygons.

 

// Reference overlay    
var referenceLayer = new Tiled("http://hydrology.esri.com/arcgis/rest/services/WorldHydroReferenceOverlay/MapServer");

//add the reference layer
map.addLayer(referenceLayer);

//Change layer order
map.reorderLayer(featureLayer, 0);
map.reorderLayer(referenceLayer, 1);

 

 

Example: http://bl.ocks.org/andybell/74fb4a1de74898126fbe

 

What is the best way to force the reference overlay to be the topmost layer?

Outcomes