<?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 can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665208#M51652</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this could help you?&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/4882/adding-shapefile-or-feature-class-as-layer-in-arcgis-desktop-using-python-arcpy" title="https://gis.stackexchange.com/questions/4882/adding-shapefile-or-feature-class-as-layer-in-arcgis-desktop-using-python-arcpy"&gt;Adding shapefile or feature class as layer in ArcGIS Desktop using Python/ArcPy? - Geographic Information Systems Stack …&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Aug 2017 06:58:53 GMT</pubDate>
    <dc:creator>JohannesBierer</dc:creator>
    <dc:date>2017-08-16T06:58:53Z</dc:date>
    <item>
      <title>How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665207#M51651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am writing a script tool to be used in ArcGIS Pro. The script tool performs some geoprocessing and saves its results to a folder. What I would like to do is add the results from disk back to the current map document. Basically, I am looking for the equivalent to the below for arcpy.mp in Python 3:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="" style="color: #393318; background-color: #eff0f1; border: 0px; font-size: 13px; margin: 0px 0px 1em; padding: 5px;"&gt;&lt;CODE style="background-color: #eff0f1; border: 0px; font-weight: inherit; font-size: 13px;"&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;"&gt;from&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arcpy &lt;/SPAN&gt;&lt;SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: inherit;"&gt;import&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; env &lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# get the map document&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mxd &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;"&gt;MapDocument&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# get the data frame&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;df &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;"&gt;ListDataFrames&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"*"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;]&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# create a new layer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;newlayer &lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;=&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;"&gt;Layer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;path_to_shapefile_or_feature_class&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;&lt;/SPAN&gt;&lt;SPAN class="" style="color: #858c93; border: 0px; font-weight: inherit; font-size: inherit;"&gt;# add the layer to the map at the bottom of the TOC in data frame 0&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;.&lt;/SPAN&gt;&lt;SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: inherit;"&gt;AddLayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;(&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;df&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt; newlayer&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;,&lt;/SPAN&gt;&lt;SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: inherit;"&gt;"BOTTOM"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: inherit;"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to add a shapefile, not a .lyrx file. Is there a way to do this with arcpy.mp? I have been looking everywhere.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2017 20:12:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665207#M51651</guid>
      <dc:creator>DeanMirabito</dc:creator>
      <dc:date>2017-08-15T20:12:33Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665208#M51652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe this could help you?&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://gis.stackexchange.com/questions/4882/adding-shapefile-or-feature-class-as-layer-in-arcgis-desktop-using-python-arcpy" title="https://gis.stackexchange.com/questions/4882/adding-shapefile-or-feature-class-as-layer-in-arcgis-desktop-using-python-arcpy"&gt;Adding shapefile or feature class as layer in ArcGIS Desktop using Python/ArcPy? - Geographic Information Systems Stack …&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 06:58:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665208#M51652</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2017-08-16T06:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665209#M51653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Johannes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the link! It is helpful, but it does not address how to perform the operation with the arcpy.mp module. I have used the arcpy.mapping module in the past, but now I am on ArcGIS Pro. It seems like some of the changes from mapping ---&amp;gt; mp have made certain operations very difficult! It is mind-boggling to me that it should be so hard to add a shapefile from disk to the TOC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:05:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665209#M51653</guid>
      <dc:creator>DeanMirabito</dc:creator>
      <dc:date>2017-08-16T13:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665210#M51654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Dean, I don't use Pro ... overread that ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:10:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665210#M51654</guid>
      <dc:creator>JohannesBierer</dc:creator>
      <dc:date>2017-08-16T13:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665211#M51655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;shp_path &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;# path to shape file&lt;/SPAN&gt;

aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"CURRENT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
map &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&amp;nbsp; &lt;SPAN class="comment token"&gt;# assumes data to be added to first map listed&lt;/SPAN&gt;
map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;addDataFromPath&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;shp_path&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:07:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665211#M51655</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T04:07:09Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665212#M51656</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Joshua, thank you so much. This is exactly what I needed. The .addDataFromPath method is a lifesaver.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 13:35:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665212#M51656</guid>
      <dc:creator>DeanMirabito</dc:creator>
      <dc:date>2017-08-16T13:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: How can I add a feature class (shapefile) to the current map doc using arcpy.mp (Python 3)?</title>
      <link>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665213#M51657</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And this works for adding feature classes, as well. &amp;nbsp;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2017 12:50:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/how-can-i-add-a-feature-class-shapefile-to-the/m-p/665213#M51657</guid>
      <dc:creator>deleted-user-25j2k-XonNEg</dc:creator>
      <dc:date>2017-09-21T12:50:13Z</dc:date>
    </item>
  </channel>
</rss>

