<?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 processed shapefiles to ArcMap automatically in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217845#M16757</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;have you tried the AddLayer function of arcpy.mapping? If so, does it work in your code? Because i tried to and i am getting errors. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With the Python Scirpt i create a FeatureClass in a FileGeodatabase and would like to add the created FeatureClass into my map. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Karin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jan 2011 09:09:56 GMT</pubDate>
    <dc:creator>karinweixler</dc:creator>
    <dc:date>2011-01-18T09:09:56Z</dc:date>
    <item>
      <title>adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217842#M16754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I run an arcpy script in ArcGIS10 to perform analysis on a shapefile, the shapefile is added to the map automatically. I can't find a way to make this happen in 9.3. I've looked for code corresponding to the "add data" button and can't seem to find anything. I've tried the addLayer but it doesn't seem to work right with a shapefile (although, I could be doing something wrong).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Import system modules&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;import sys, string, os, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Create the Geoprocessor object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp = arcgisscripting.create()&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Load required toolboxes...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Local variables...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;shapefile_name = "shapefile_name"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;selected_shp = gp.GetParameterAsText(0)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Output_Feature_Class = gp.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Select...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Select_analysis(shapefile_name, selected_shp, "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Dissolve...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.Dissolve_management(selected_shp, Output_Feature_Class, "", "", "MULTI_PART", "DISSOLVE_LINES")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Add the shapefile to the map&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;gp.AddFeatureLayer(selected_shp,Output_Feature_Class)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for any help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 14:59:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217842#M16754</guid>
      <dc:creator>denisedavis</dc:creator>
      <dc:date>2010-12-23T14:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217843#M16755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try gp.AddOUtputsToMap=True.&amp;nbsp; That works with a arcgisscripting gp object, but not with arcpy.&amp;nbsp; But with arcpy, you can simply write the code to add layers with arcpy.mapping.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, there is a switch in the geoprocessing options to automatically add gp results to the display.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 26 Dec 2010 15:18:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217843#M16755</guid>
      <dc:creator>MikeHunter</dc:creator>
      <dc:date>2010-12-26T15:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217844#M16756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the input. I'm not able to try it right now, however as soon as I'm able to give it a shot, I will.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Jan 2011 19:36:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217844#M16756</guid>
      <dc:creator>denisedavis</dc:creator>
      <dc:date>2011-01-01T19:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217845#M16757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;have you tried the AddLayer function of arcpy.mapping? If so, does it work in your code? Because i tried to and i am getting errors. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With the Python Scirpt i create a FeatureClass in a FileGeodatabase and would like to add the created FeatureClass into my map. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Karin&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 09:09:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217845#M16757</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-18T09:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217846#M16758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You have to create an layer object before you can add it to the map with addLayer. yourLayer=arcpy.Layer('path')&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 11:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217846#M16758</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2011-01-18T11:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: adding processed shapefiles to ArcMap automatically</title>
      <link>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217847#M16759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the hint! That solved the problem.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jan 2011 12:03:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-processed-shapefiles-to-arcmap/m-p/217847#M16759</guid>
      <dc:creator>karinweixler</dc:creator>
      <dc:date>2011-01-18T12:03:50Z</dc:date>
    </item>
  </channel>
</rss>

