<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Updating group layer symbology in arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425494#M33413</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sourceLayer = arcpy.mapping.Layer(r"For Review\T23001510")[0]&lt;/P&gt;&lt;P&gt;did you try just removing [0] from the line?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 Jun 2016 20:03:13 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2016-06-20T20:03:13Z</dc:date>
    <item>
      <title>Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425493#M33412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I'm new to python, but I'm trying to apply the symbology from one layer to a group of others without manually importing each one. I could build a model using the ApplySymbologyFromLayer_management tool, but it does not work if there are features (e.g. polygons) missing in the layer; but I want these feature classes present across all layers because I am drawing them in. I was able to use the following python script to apply symbology to a single layer from another:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; import arcpy&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; mxd = arcpy.mapping.MapDocument("Current")&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; updateLayer = arcpy.mapping.ListLayers(mxd, "T33001700", df)[0]&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; sourceLayer = arcpy.mapping.Layer(r"For Review\T23001510")[0]&lt;/P&gt;&lt;P&gt;Runtime error&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;TypeError: 'Layer' object does not support indexing&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; sourceLayer = arcpy.mapping.Layer(r"T23001510")&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; arcpy.mapping.UpdateLayer(df, updateLayer, sourceLayer, True)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#But if I try to change the update layer to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt;&amp;gt; updateLayer = arcpy.mapping.ListLayer(mxd, "In Progress", df) #where "In Progress" is the group of layers I want to change the symbology of&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#then I get the error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Runtime error&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\utils.py", line 182, in fn_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\mapping.py", line 1888, in UpdateLayer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assert isinstance(update_layer, Layer)&lt;/P&gt;&lt;P&gt;AssertionError&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 19:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425493#M33412</guid>
      <dc:creator>AndrewGehlot</dc:creator>
      <dc:date>2016-06-20T19:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425494#M33413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sourceLayer = arcpy.mapping.Layer(r"For Review\T23001510")[0]&lt;/P&gt;&lt;P&gt;did you try just removing [0] from the line?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:03:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425494#M33413</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-20T20:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425495#M33414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the reply.&lt;/P&gt;&lt;P&gt;Yes I did and I get the error:&lt;/P&gt;&lt;P&gt;Runtime error &lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "&amp;lt;string&amp;gt;", line 1, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\utils.py", line 182, in fn_&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return fn(*args, **kw)&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "c:\program files (x86)\arcgis\desktop10.4\arcpy\arcpy\mapping.py", line 1888, in UpdateLayer&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assert isinstance(update_layer, Layer)&lt;/P&gt;&lt;P&gt;AssertionError&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if there's some way to identify the group layer and then iterate through each one? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:10:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425495#M33414</guid>
      <dc:creator>AndrewGehlot</dc:creator>
      <dc:date>2016-06-20T20:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425496#M33415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From here &lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/listlayers.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/listlayers.htm"&gt;ListLayers—Help | ArcGIS for Desktop&lt;/A&gt; group layers are supposed to be treated just like layers&lt;/P&gt;&lt;P&gt;So have a read... expecially this&lt;/P&gt;&lt;P&gt;When working with layer files, the &lt;SPAN class="arcpyref"&gt;data_frame&lt;/SPAN&gt; parameter should not be used because layer files don't support data frames; if it is, it will be ignored. The &lt;A class="xref" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/layer.htm"&gt;&lt;SPAN style="color: #0066cc; text-decoration: underline;"&gt;Layer()&lt;/SPAN&gt;&lt;/A&gt; function is for referencing layer (&lt;SPAN class="usertext"&gt;.lyr&lt;/SPAN&gt;) files stored on disk.&lt;/P&gt;&lt;P&gt; &lt;EM&gt;Group layers are treated just like layers. The index values are simply generated from top to bottom as they appear in the table of contents or the way they would appear in a layer file. The same applies if a group layer is within another group layer. A map document with a single group layer with three layers within it will return a Python list of four layer objects, the group layer being the first. One way of determining if a layer is inside a group layer is to interrogate the &lt;SPAN class="arcpyref"&gt;longName&lt;/SPAN&gt; property. A layer's &lt;SPAN class="arcpyref"&gt;longName&lt;/SPAN&gt; will include the group layer name as part of the name. &lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:15:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425496#M33415</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-20T20:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425497#M33416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I had just read that earlier--it says group layers are treated just like layers, which is strange because it will identify and update my single layer within the group if I set a path to it (mxd, "T33001680", df), but it will not if I identify the entire group that the layer (as well as several other layers of the same type) are contained in (mxd, "In Progress", df)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:20:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425497#M33416</guid>
      <dc:creator>AndrewGehlot</dc:creator>
      <dc:date>2016-06-20T20:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425498#M33417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;its the dataframe property should not be used ... reference&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:29:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425498#M33417</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-20T20:29:53Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425499#M33418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But when I run the arcpy function for UpdateLayer, it asks for a dataframe. Also, when I use a single layer and identify a dataframe ("df") it works. I've tried leaving that field blank for the updateLayer, but it still returns the error.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:42:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425499#M33418</guid>
      <dc:creator>AndrewGehlot</dc:creator>
      <dc:date>2016-06-20T20:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Updating group layer symbology in arcpy</title>
      <link>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425500#M33419</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you might want to throw some print statements in and loops if necessary, to see what you are actually getting, so referencing the mxd and examining the coding options here should help.&amp;nbsp; It is hard to debug remotely without fuller information as to what is being returned other than the error when what is returned isn't right&lt;/P&gt;&lt;P&gt;&lt;A href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/listlayers.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/listlayers.htm"&gt;ListLayers—Help | ArcGIS for Desktop&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 Jun 2016 20:49:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updating-group-layer-symbology-in-arcpy/m-p/425500#M33419</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-06-20T20:49:10Z</dc:date>
    </item>
  </channel>
</rss>

