Select to view content in your preferred language

JS API: reorder layers with a tiled reference layer

3543
2
Jump to solution
07-31-2015 01:21 PM
AndyBell4
Deactivated User

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?

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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.

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

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.

RobertScheitlin__GISP
MVP Emeritus

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.