<?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: Adding feature class to map script in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164061#M7416</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in Pro results are supposed to be automatically added to the display.&amp;nbsp; It is the 2 'output' types which I don't think is working&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Nov 2018 00:39:37 GMT</pubDate>
    <dc:creator>DanPatterson_Retired</dc:creator>
    <dc:date>2018-11-19T00:39:37Z</dc:date>
    <item>
      <title>Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164053#M7408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I created a python script tool that creates a Thiessen Polygons. The tool runs fine. But how do I create it so that it automatically adds a new layer to the map? Right now, it only creates it in the geodatabase. I would have to manually drag and drop it into the map to get it to appear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jonah&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2018 23:43:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164053#M7408</guid>
      <dc:creator>JonahLay1</dc:creator>
      <dc:date>2018-11-16T23:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164054#M7409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the script is attached to a tool in arctoolbox, then the results should be added to the display (I assume that your featureclass is an output parameter).&lt;/P&gt;&lt;P&gt;If you are running the script as a standalone script, it probably won't automatically since there may be a disconnect between the scripting environment and the project... obviously if Pro is closed, it won't add it at all, which is where the arcpy.mp (aka mapping module) comes in and using 'CURRENT' for the aprx.&lt;/P&gt;&lt;P&gt;You can try&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm" title="http://pro.arcgis.com/en/pro-app/tool-reference/data-management/make-feature-layer.htm"&gt;Make Feature Layer—Data Management toolbox | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to see if that helps.&lt;/P&gt;&lt;P&gt;But the surefire way is to make your script run from a tool in a toolbox in ArcToolbox&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 03:04:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164054#M7409</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-11-17T03:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164055#M7410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is an oldie but should get your started... just the simple toolbox incarnation, but easy to follow&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/blogs/dan_patterson/2016/05/19/toolbox-creation-in-arcgis-pro"&gt;/blogs/dan_patterson/2016/05/19/toolbox-creation-in-arcgis-pro&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 03:06:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164055#M7410</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-11-17T03:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164056#M7411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thank you for the response and resources. I believe my script is attached to the toolbox:&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/429813_Capture.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried "arcpy.MakeFeatureLayer_management". But there is no difference when I run the tool. However, if I run the same script through the python window, two of the same layers get displayed. One from analysis.CreateThiessenPolygons and the other from MakeFeatureLayer_management.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a reason for this? The same script runs in the python window but doesn't display through the tool.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 04:13:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164056#M7411</guid>
      <dc:creator>JonahLay1</dc:creator>
      <dc:date>2018-11-17T04:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164057#M7412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check your parameter list in the tool.&amp;nbsp; The your result of the process needs to be an 'output'.&amp;nbsp; maybe a screen grab of the parameters&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 04:44:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164057#M7412</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-11-17T04:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164058#M7413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you. This is what I have:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/429814_Capture.JPG" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 05:04:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164058#M7413</guid>
      <dc:creator>JonahLay1</dc:creator>
      <dc:date>2018-11-17T05:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164059#M7414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hmmmm&amp;nbsp;&lt;/P&gt;&lt;P&gt;number, Label/Name Direction Data Type&lt;/P&gt;&lt;P&gt;0 Input_Features &amp;nbsp; Input &amp;nbsp; Feature_layer&lt;/P&gt;&lt;P&gt;1 Fields_to_copy &amp;nbsp; Input &amp;nbsp;&amp;nbsp; (did you check 'Dependency (input_features)' so you can chose from a list of fields?&lt;/P&gt;&lt;P&gt;2 Output_Feature&amp;nbsp; Output&amp;nbsp; I always try Feature Class or Feature Layer when one or the other doesn't work.&amp;nbsp; I always put output as the last parameter and it is the only output parameter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 05:22:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164059#M7414</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-11-17T05:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164060#M7415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried both Feature Class or Feature Layer. It didn't seem to make any difference. I was modelling the parameters after the default Thiessen Polygon tool in Pro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do you think it is a parameter setting that is preventing the layer from displaying automatically and not the script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Nov 2018 05:32:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164060#M7415</guid>
      <dc:creator>JonahLay1</dc:creator>
      <dc:date>2018-11-17T05:32:23Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164061#M7416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;in Pro results are supposed to be automatically added to the display.&amp;nbsp; It is the 2 'output' types which I don't think is working&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Nov 2018 00:39:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/164061#M7416</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2018-11-19T00:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Adding feature class to map script</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/1100062#M45781</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Any success with this? As of Pro 2.8 I'm having the same issue.&lt;/P&gt;&lt;P&gt;Working from a notebook, this successfully adds a feature class to the map.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os
data = r'path\to\BaseLayer_Processed_Elementary_08302021_clip'
arcpy.env.addOutputsToMap = True 

try:

arcpy.management.MakeFeatureLayer(data, data) 
    
except:
    print(arcpy.GetMessages())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, according to the docs the above only creates a temp layer in the map. So, unless you save the map or export the layer to a feature class it won't be saved. So, I tried the below script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os
data = r'path\to\BaseLayer_Processed_Elementary_08302021_clip'
arcpy.env.addOutputsToMap = True 

try:

    # Write the selected features to a new featureclass
    arcpy.CopyFeatures_management(data, os.path.basename(data))
    
except:
    print(arcpy.GetMessages())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both scripts work to add a feature class to the map. However, when I convert to a script tool to run within pro it runs successfully, but nothing is added to the map.&lt;/P&gt;&lt;P&gt;Tool version of the script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy, os

#input feature class from model. It will be added to the map.
data = arcpy.GetParameterAsText(0)
arcpy.env.addOutputsToMap = True
arcpy.AddMessage(f'adding to map: {data}') 

try:

    #Copies features from the input feature class or layer to a new feature class.
    arcpy.CopyFeatures_management(data, os.path.basename(data))
    
except:
    arcpy.AddMessage(arcpy.GetMessage())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tool interface:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JaredPilbeam2_0-1632166144459.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/23412iEEA3B8446A011538/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaredPilbeam2_0-1632166144459.png" alt="JaredPilbeam2_0-1632166144459.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 19:37:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/adding-feature-class-to-map-script/m-p/1100062#M45781</guid>
      <dc:creator>JaredPilbeam2</dc:creator>
      <dc:date>2021-09-20T19:37:08Z</dc:date>
    </item>
  </channel>
</rss>

