I have ArcGIS project (.mxd) with group structure like shown below with some feature layers inside (which are stored in file geodatabase). What I need is to copy group structure from "old_layers" to "new_layers" and clone feature layers preserving group structure they were before.

Structure before transformation:

enter image description here

Structure after transformation (layers which are in "new_layers" group should be "new", cloned based on layers from "old_layers" group:

enter image description here

What I achieved so far is cloning layers giving them different suffix (arcpy.Copy_management method) Then I created new .lyr file which is a copy of "old_feature" layers so the structure of groups is preserved, then I can add new (cloned) feature layers to the .lyr file with arcpy.mapping.AddLayerToGroup method, some loops and if conditions but the last step (removing old feature layers from .lyr - arcpy.mapping.RemoveLayer) - doesnt work, so I have old and new feature layers in the same structure.

I hope you get my point.

  • 1
    Please provide your code in the body of the question. – Vince Apr 2 at 12:28
  • 1
    There are two types of layers, the .lyr reside on disk, the other are in the TOC. You are manipulating both? – klewis Apr 2 at 15:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.