AnsweredAssumed Answered

Determining if a layer is a baselayer in layer-add-result event

Question asked by kenbuja on Nov 26, 2014
Latest reply on Dec 12, 2014 by kenbuja

I am adding several layers (both dynamic and tiled) programmatically to my map. In the layer-add-result event, I am setting the visibility to false and the visibleLayers to -1 for all the layers.

 

map.on("layer-add-result", function (addedLayer) {
    addedLayer.layer.setVisibility(false);
    addedLayer.layer.setVisibleLayers([-1]);
});

 

However, when I create the map with a basemap, the basemap layer( or layers, since some basemaps have multiple layers) will also fire this event. Since I want to keep the basemap visible, how can I determine if the layer a basemap?

Outcomes