Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Pulling Feature Layer from Group Layer and apply Symbology?

$
0
0
I'm trying to use the symbology from a layer file, to apply to a layer in my map via python. My layer file is a group layer file. The layer in the map is not a grouped layer file. When I do this:

Code:

for lyr in arcpy.mapping.ListLayers(mxd,"",df):
    Layer = arcpy.mapping.Layer(path_to_LayerFile)
    arcpy.ApplySymbologyFromLayer_management (lyr, Layer)

It will crash beause the 'Layer' is a group layer, where lyr is not.

I flipped through the arcpy.mapping.Layer helpfile here and I can see that I can test for isGroupLayer or isFeatureLayer, but I'm not sure how I would go about grabbing the underlying feature layer from the group layer and apply the symbology to lyr in my example about? More specifically, I don't suppose there is a directory path for feature layers inside of a group layer (i.e. G:\layers\Test_Grid_Group.lyr\Unit) <---That doesn't work, but I'm looking for something like that....

Viewing all articles
Browse latest Browse all 2485

Trending Articles