Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am having problems in ArcObjects. I am struggling to get to the individual (feature-)layers inside a GroupLayer. Does anyone know how to do that ?

share|improve this question
up vote 4 down vote accepted

Try this:

public List<ILayer> GetLayers(string groupLayerName)

    ICompositeLayer compositeLayer = GetGroupLayer(groupLayerName);
    List<ILayer> layers = new List<ILayer>();

    if (compositeLayer != null)
        for (int j = 0; j < compositeLayer.Count; j++)
            layers.Add(new Layer(compositeLayer.Layer[j]));
    return layers;

ICompositeLayer GetGroupLayer(string groupLayerName)
     var mapLayers = _map.Layers;
     for (var layer = mapLayers.Next(); layer != null; layer = mapLayers.Next())
            var comLayer = layer as ICompositeLayer;
            var groupLayer = layer as IGroupLayer;
            if ((comLayer != null) && (groupLayer != null) && (layer.Name.Equals(groupLayerName)))
                return groupLayer;
share|improve this answer

Cast the group layer to ICompositeLayer which allows you to access the individual sublayers.

Provides access to members that work with a collection of layers that behaves like a single layer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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