The 'addLayerToGroup' python function adds the layer redundantly to the target group layer as well as in the Table Of Contents as a separate layer in ArcGIS Pro.
Last Published: February 18, 2019ArcGIS Pro
Bug ID Number
BUG-000110978
Submitted
January 20, 2018
Last Modified
June 5, 2024
Applies to
ArcGIS Pro
Version found
2.1
Status
Will Not Be Addressed
The development team has considered the issue or request and concluded it will not be addressed. The issue's Additional Information section may contain further explanation.
Additional Information
This is being marked as designed. If you look at the code carefully, when calling m.addDataFromPath WITHIN addLayerToGroup, it is doing two things: First, adding a layer to the map AND also adding a layer to the group. The work around is to either add a layer to the map and then use MOVELAYER or reference a layer file. See code sample below#AddLayerToGroupm.addLayerToGroup(grpLyr, lyrFile, "TOP") #THIS DOES NOT DUPLICATEm.addLayerToGroup(grpLyr, m.addDataFromPath(FC), "TOP") #THIS DOES