Adding a empty layer to group layer python using a list

المشرف العام

Administrator
طاقم الإدارة
i would like some help adding a empty group to a group layer. Back drop

i am trying to create groups within Arc map that can contain up to 2 sub groups. i have the name of groups stored as lists. List 1 = Order 1 groups , List_2 = Order 2 Groups and List 3 = Order 3 Groups

So far ,

i have started of with a blank map and have used the first list to build the first order groups

Group_1 = ['Scotland','England','Wales','Spain']for first_Group in Group_1: mxd = arcpy.mapping.MapDocument(r"C:\GIS\PROJECT\PYTHON\GROUP_LAYER_TEMPLATE_copy.mxd") df = arcpy.mapping.ListDataFrames(mxd)[0] groupLayer = arcpy.mapping.Layer(r"C:\GIS\PROJECT\PYTHON\\An_empty_Group_Layer.lyr") arcpy.mapping.AddLayer(df, groupLayer, "BOTTOM") layers = arcpy.mapping.ListLayers(mxd) for layer in layers: if layer.isGroupLayer and layer.name == "An_empty_Group_Layer": layer.name = first_Group mxd.save()So now i would like to be able to build a layer and add to to an all ready existing layer that has been created

The second list is map up of a list of list

Group_2 = [['Scotland','Aberdeen'],['Scotland','Glasgow'],['Scotland','Inverness'],['England','london']['England','bristol']['England','New_Castle']] So i can access the use the first item on the list as the group it will set under and the second item for the name.

i found a couple of threads

i tried to implement this one , but was not able to get it to work i cannot understand if the layetrs are physical layers or not

previous question



أكثر...
 
أعلى