<?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: How to add a new Group Layer using arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62803#M5082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you'd want &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mxd.save()&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mxd.saveACopy()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Nov 2011 14:05:34 GMT</pubDate>
    <dc:creator>MathewCoyle</dc:creator>
    <dc:date>2011-11-23T14:05:34Z</dc:date>
    <item>
      <title>How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62800#M5079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to create a layer structure that looks something like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Food&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; [INDENT] - Fruit&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [INDENT]-Apple&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [INDENT]&amp;lt;feature layers for Apples 1&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;feature layers for Apples 2&amp;gt;[/INDENT][/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [INDENT]-Apricots &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [INDENT]&amp;lt;features layer for Apricots 1&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;features layer for Apricots 2&amp;gt;[/INDENT][/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;etc...[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So what I am looking for is something that allows me to create a "layer group". Since there is not a "layer group tool" I thought I would just create one in python. That is where I am having trouble.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can use addLayer to add a .lyr file but the only adds a layer to an existing "layer group". Can anyone tell me how to create a layer group? (other than in the GUI) Is there anyway to accomplish this that I am not seeing?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-matt&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Oct 2011 12:25:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62800#M5079</guid>
      <dc:creator>MattSiple</dc:creator>
      <dc:date>2011-10-14T12:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62801#M5080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is not possible with arcpy.mapping.&amp;nbsp; You would need to author the group structure ahead of time.&amp;nbsp; You could then use arcpy.mapping.AddLayer and arcpy.mapping.AddLayerToGroup to insert layers into your mxd.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Oct 2011 02:33:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62801#M5080</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2011-10-18T02:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62802#M5081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;import arcpy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd, "County Maps")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;targetGroupLayer = arcpy.mapping.ListLayers(mxd, "24000 Scale Data", df)[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;addLayer = arcpy.mapping.Layer(r"C:\Project\Data\StreetsWithLabels.lyr")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.mapping.AddLayerToGroup(df, targetGroupLayer, addLayer, "BOTTOM")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mxd.saveACopy(r"C:\Project\Project2.mxd")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;del mxd, addLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That works, except a layer is only added to a group layer in the new mxd - C:\Project\Project2.mxd - not the current mxd if you are using the Python window from within ArcMap.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 13:44:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62802#M5081</guid>
      <dc:creator>KristinaGrace</dc:creator>
      <dc:date>2011-11-23T13:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62803#M5082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I think you'd want &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mxd.save()&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mxd.saveACopy()&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 14:05:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62803#M5082</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-11-23T14:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62804#M5083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That's the weird thing: that doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've also tried to refresh the view and TOC but this must be something to do with the group layer...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshActiveView()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.RefreshTOC()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 14:55:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62804#M5083</guid>
      <dc:creator>KristinaGrace</dc:creator>
      <dc:date>2011-11-23T14:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new Group Layer using arcpy</title>
      <link>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62805#M5084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Strangely, it works now&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2011 15:22:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-to-add-a-new-group-layer-using-arcpy/m-p/62805#M5084</guid>
      <dc:creator>KristinaGrace</dc:creator>
      <dc:date>2011-11-23T15:22:42Z</dc:date>
    </item>
  </channel>
</rss>

