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?
Solved! Go to Solution.
The issue here is that you're using a FeatureLayer. That inherits from a GraphicLayer, which is always shown on top of tiled or dynamic layers.
The issue here is that you're using a FeatureLayer. That inherits from a GraphicLayer, which is always shown on top of tiled or dynamic layers.
Andy,
The issue you are seeing id that the FeatureLayer that you are adding will always draw on top of other layers that are not FeatureLayers or that inherit from GraphicsLayer. This is a known limitation of the 3.x JS API and is something that will be reworked in the 4.x JS API.