<?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: Add layer from one datar frame to others in same .mxd in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549284#M42890</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is what I've come up with so far. I don't know how to add that layer to the other two data frames in the Austin_TX.mxd file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Parks")[0]
addLayer = arcpy.mapping.Layer(r"parks.lyr")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
mxd.saveACopy(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd")
del mxd, addLayer&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 23:45:49 GMT</pubDate>
    <dc:creator>RossRomero</dc:creator>
    <dc:date>2021-12-11T23:45:49Z</dc:date>
    <item>
      <title>Add layer from one datar frame to others in same .mxd</title>
      <link>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549282#M42888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I need to write a script that adds the parks layer from the parks data frame in the Austin_TX.mxd (attached)to the other two data frames in the same map document. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help would be greatly appreciated. I know this is a very easy script, but I cant seem to wrap my mind around doing it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 02:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549282#M42888</guid>
      <dc:creator>RossRomero</dc:creator>
      <dc:date>2014-05-07T02:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: Add layer from one datar frame to others in same .mxd</title>
      <link>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549283#M42889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You want to use &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/InsertLayer/00s30000000z000000/"&gt;InsertLayer&lt;/A&gt;&lt;SPAN&gt;. Give that a try and post back with any problems you have.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 12:06:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549283#M42889</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2014-05-07T12:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Add layer from one datar frame to others in same .mxd</title>
      <link>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549284#M42890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is what I've come up with so far. I don't know how to add that layer to the other two data frames in the Austin_TX.mxd file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Parks")[0]
addLayer = arcpy.mapping.Layer(r"parks.lyr")
arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
mxd.saveACopy(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd")
del mxd, addLayer&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:45:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549284#M42890</guid>
      <dc:creator>RossRomero</dc:creator>
      <dc:date>2021-12-11T23:45:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add layer from one datar frame to others in same .mxd</title>
      <link>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549285#M42891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well, that's not using InsertLayer. There's a good example at the link I provided. Anyway, if you want to use AddLayer. change this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; df = arcpy.mapping.ListDataFrames(mxd, "Parks")[0]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-family:verdana;"&gt;to this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; df = arcpy.mapping.ListDataFrames(mxd, "Parks")[1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 3; font-family: verdana;"&gt;&lt;SPAN style="font-size:2;"&gt;and so on. the [0] refers to your first data frame. [1] is the second, [2] is the third, etc. &lt;BR /&gt;You can call the function twice, or put it in a loop something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy 
mxd = arcpy.mapping.MapDocument(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd") dfList = arcpy.mapping.ListDataFrames(mxd, "Parks") addLayer = arcpy.mapping.Layer("parks.lyr")

for df in dfList:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.mapping.AddLayer(df, addLayer, "BOTTOM")
mxd.saveACopy(r"P:\G4910\G4910_06\Data\Data\Exercise10\Austin_TX.mxd") del mxd, addLayer&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 23:45:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-layer-from-one-datar-frame-to-others-in-same/m-p/549285#M42891</guid>
      <dc:creator>Zeke</dc:creator>
      <dc:date>2021-12-11T23:45:52Z</dc:date>
    </item>
  </channel>
</rss>

