<?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 layer in mxd and save it? in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110300#M684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After you make the feature layer, use the add layer scrip. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.MakeFeatureLayer_management("C:/data/mexico.gdb/cities","cities_lyr")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AddLayer (data_frame, &lt;STRONG&gt;"cities_lyr"&lt;/STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2015 20:59:05 GMT</pubDate>
    <dc:creator>SepheFox</dc:creator>
    <dc:date>2015-05-29T20:59:05Z</dc:date>
    <item>
      <title>How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110294#M678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a layer &lt;STRONG&gt;Test&lt;/STRONG&gt; generated by &lt;STRONG&gt;arcpy.MakeFeatureLayer_management &lt;/STRONG&gt;and Dissolved by &lt;STRONG&gt;arcpy.Dissolve_management ..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I know that this layer is in&amp;nbsp; &lt;STRONG&gt;.gdb&lt;/STRONG&gt;&amp;nbsp; data source..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;How can i add this layer to my .MXD and save that .MXD using PYTHON?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 19:59:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110294#M678</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-05-29T19:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110295#M679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This might help: &lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000025000000" title="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s300000025000000"&gt;ArcGIS Desktop&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and look at the save method here: &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000000n000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000000n000000"&gt;ArcGIS Help 10.1&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:00:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110295#M679</guid>
      <dc:creator>TimWitt2</dc:creator>
      <dc:date>2015-05-29T20:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110296#M680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok I got how to save MXD , and add Layer in MXD...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But that layer is exist on disk with .lyr extension ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My layer data is in .gdb datasource....&amp;nbsp;&amp;nbsp; how to add layer from .gdb source to MXD?&lt;BR /&gt;Am i Getting it right?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:08:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110296#M680</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-05-29T20:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110297#M681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Waqar, you just need to make a feature layer first, then add the layer the way Tim describes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;SPAN class="pln"&gt;C &lt;/SPAN&gt;&lt;SPAN class="pun"&gt;=&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; r&lt;/SPAN&gt;&lt;SPAN class="str"&gt;"C:\...\featureclass"&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;&lt;BR /&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ"&gt;MakeFeatureLayer_management&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;(&lt;/SPAN&gt;&lt;SPAN class="pln"&gt;FC&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;,&lt;/SPAN&gt;&lt;SPAN class="pln"&gt; &lt;/SPAN&gt;&lt;SPAN class="str"&gt;"nameoffeatureclass"&lt;/SPAN&gt;&lt;SPAN class="pun"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:25:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110297#M681</guid>
      <dc:creator>SepheFox</dc:creator>
      <dc:date>2015-05-29T20:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110298#M682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sir I am making Feature layer first. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN class="pln" style="font-family: monospace;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="pun" style="font-family: monospace;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="typ" style="font-family: monospace;"&gt;MakeFeatureLayer_management &lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class="typ" style="font-family: monospace;"&gt;creates datasource of the layer in .gdb&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="typ" style="font-family: monospace;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="typ" style="font-family: monospace;"&gt;how to add that datasouce in MXD? &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:42:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110298#M682</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-05-29T20:42:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110299#M683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to create a Layer Object from your feature class then add that layer to your mxd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://gis.stackexchange.com/questions/4882/adding-shapefile-as-layer-in-arcgis-desktop-using-python-arcpy" title="http://gis.stackexchange.com/questions/4882/adding-shapefile-as-layer-in-arcgis-desktop-using-python-arcpy"&gt;Adding shapefile as layer in ArcGIS Desktop using Python/ArcPy? - Geographic Information Systems Stack Exchange&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:56:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110299#M683</guid>
      <dc:creator>IanMurray</dc:creator>
      <dc:date>2015-05-29T20:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110300#M684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After you make the feature layer, use the add layer scrip. For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;arcpy.MakeFeatureLayer_management("C:/data/mexico.gdb/cities","cities_lyr")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;AddLayer (data_frame, &lt;STRONG&gt;"cities_lyr"&lt;/STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 20:59:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110300#M684</guid>
      <dc:creator>SepheFox</dc:creator>
      <dc:date>2015-05-29T20:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110301#M685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks all of you for your help...........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 22:33:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110301#M685</guid>
      <dc:creator>waqarahmad</dc:creator>
      <dc:date>2015-05-29T22:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to add layer in mxd and save it?</title>
      <link>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110302#M686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The accepted answer on StackExchange works for ArcGIS Desktop, which is what the OP was asking about, but the accepted answer won't work for ArcGIS Pro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.mapping&lt;/SPAN&gt; &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/layer-class.htm"&gt;Layer &lt;/A&gt;function was removed in ArcGIS Pro, it has been replaced with &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/layerfile.htm"&gt;LayerFile&lt;/A&gt;.&amp;nbsp; If one looks at the Summary for &lt;A href="http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-mapping/layer-class.htm"&gt;Layer&lt;/A&gt;:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;SPAN style="font-size: 18pt;"&gt;Summary&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Provides access to layer properties and methods. It can either reference layers in a map document (.&lt;STRONG&gt;mxd&lt;/STRONG&gt;) or layers in a layer (.&lt;STRONG&gt;lyr&lt;/STRONG&gt;) file.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It turns out, the accepted answer on StackExchange was never supposed to work but it does.&amp;nbsp; Originally, &lt;SPAN style="font-family: courier new,courier;"&gt;arcpy.mapping&lt;/SPAN&gt; Layer was designed to work on layers in MXDs or existing layer files, but there was a bug that allowed it to work directly against some data sources (but not all).&amp;nbsp; Since the hack was fairly common place, the bug wasn't fixed, until ArcGIS Pro.&amp;nbsp; To avoid confusion over changed functionality and having people submit bug reports, Layer was renamed LayerFile to emphasize how it is designed to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't remember right off the top what the workflow is in Pro.&amp;nbsp; I will post it later if I find it or remember.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 May 2015 17:00:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/how-to-add-layer-in-mxd-and-save-it/m-p/110302#M686</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2015-05-31T17:00:26Z</dc:date>
    </item>
  </channel>
</rss>

