AnsweredAssumed Answered

Wrong path when adding a layer within a group in a document ??

Question asked by brown_222 on Feb 28, 2018
Latest reply on Mar 2, 2018 by gkmieliauskas_cellexp

Hi,

If I add a layer to a document like this, there is no problem :

 

(myDocument.get_Map(0) as IMapLayers).AddLayer(myLayer);

 

but if I add my layer within a group like this, the layer path is not valid when I open my mxd file.

 

IGroupLayer myGroupLayer = new GroupLayer();
myGroupLayer .Name = "test";

(myDocument.get_Map(0) as IMapLayers).AddLayer(myGroupLayer );

(myDocument.get_Map(0) as IMapLayers).InsertLayerInGroup(myGroupLayer as IGroupLayer, myLayer, true, 0);

 

 

Any ideas ? I'm using ArcMap 10.0 SP4

 

Thanks

 

Charles

Outcomes