<?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 Send a feature to a map using Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191111#M14670</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have python script that creates a point feature class.&amp;nbsp; How do I send that feature to an existing map using Python?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Oct 2014 17:30:42 GMT</pubDate>
    <dc:creator>StephenEldridge</dc:creator>
    <dc:date>2014-10-30T17:30:42Z</dc:date>
    <item>
      <title>Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191111#M14670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;I have python script that creates a point feature class.&amp;nbsp; How do I send that feature to an existing map using Python?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 17:30:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191111#M14670</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-30T17:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191112#M14671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;do you mean &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Make_Feature_Layer/00170000006p000000/"&gt;makefeaturelayer&lt;/A&gt; ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 17:57:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191112#M14671</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-10-30T17:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191113#M14672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My script already makes the feature and puts it into a file geodatabase.&amp;nbsp; I would like it to also take that same feature class and drop it into an ArcMap.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191113#M14672</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-30T18:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191114#M14673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so I assume you have ArcMap set to &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#/Using_geoprocessing_options_to_control_tool_execution/00210000000q000000/"&gt;add results to display &lt;/A&gt;and set visibility on?&amp;nbsp; And I have to ask the obvious...you are running this from within ArcMap?&amp;nbsp; some people have tried to add layers to arcmap without it being open&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:07:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191114#M14673</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-10-30T18:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191115#M14674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using Python script that runs in the background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;#Import Time and Date&lt;BR /&gt;import time&lt;BR /&gt;import datetime&lt;/P&gt;&lt;P&gt;#Sets a variable to hold today's date in year month day (yyyymmdd)format to tag feature output name with the current date&lt;BR /&gt;currentdate = datetime.date.today().strftime("%Y""%m""%d")&lt;/P&gt;&lt;P&gt;# Overwrite pre-existing files&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;# Local variables:&lt;BR /&gt;Changes = "\\\\MyData\\Working_Data.mdb\\Changes"&lt;BR /&gt;Changes_Layer = "Changes_Layer"&lt;BR /&gt;Updates = "\\\\MyData\\My_Data.gdb\\Updates\\Updates"+str(currentdate)&lt;/P&gt;&lt;P&gt;# Process: Make XY Event Layer&lt;BR /&gt;arcpy.MakeXYEventLayer_management(Changes, "longitude", "latitude", Changes_Layer, "", "")&lt;/P&gt;&lt;P&gt;# Process: Feature To Point&lt;BR /&gt;arcpy.FeatureToPoint_management(Changes_Layer, Updates, "CENTROID")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I would like to add Python script that will take "Updates"+str(currentdate)" and add it to MyDataUpdates.mxd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:15:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191115#M14674</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-10-30T18:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191116#M14675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe you're looking for&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000025000000"&gt; arcpy.mapping.AddLayer()&lt;/A&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:21:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191116#M14675</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2014-10-30T18:21:54Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191117#M14676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;grief... &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/laugh.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Oct 2014 18:23:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191117#M14676</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-10-30T18:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191118#M14677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;addLayer is what&amp;nbsp; am trying to use now but I keep getting this error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Traceback (most recent call last):&lt;/P&gt;&lt;P&gt;&amp;nbsp; File "\\c:\MyLocation\Tools\Scripts\Changes.py", line 39, in &amp;lt;module&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; df = arcpy.mapping.ListDataFrames(mxd, "Update")[0]&lt;/P&gt;&lt;P&gt;IndexError: list index out of range&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This one has me stumped.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Import arcpy module&lt;BR /&gt;import arcpy&lt;/P&gt;&lt;P&gt;#Import Time and Date&lt;BR /&gt;import time&lt;BR /&gt;import datetime&lt;/P&gt;&lt;P&gt;#Sets a variable to hold today's date in year month day (yyyymmdd)format to tag feature output name with the current date&lt;BR /&gt;currentdate = datetime.date.today().strftime("%Y""%m""%d")&lt;/P&gt;&lt;P&gt;# Overwrite pre-existing files&lt;BR /&gt;arcpy.env.overwriteOutput = True&lt;/P&gt;&lt;P&gt;# Local variables:&lt;BR /&gt;Changes = "\\\\c:\\MyLocation\\\\Working_Data.mdb\\Changes"&lt;BR /&gt;Changes_Layer = "Changes_Layer"&lt;BR /&gt;Update = "\\\\c:\\MyLocation\\MyGeo.gdb\\Updates\\Updates"+str(currentdate)&lt;/P&gt;&lt;P&gt;# Process: Make XY Event Layer&lt;BR /&gt;arcpy.MakeXYEventLayer_management(Changes, "longitude", "latitude", Changes_Layer, "", "")&lt;/P&gt;&lt;P&gt;# Process: Feature To Point&lt;BR /&gt;arcpy.FeatureToPoint_management(Changes_Layer, Updates, "CENTROID")&lt;/P&gt;&lt;P&gt;#Add layer into primary map document&lt;/P&gt;&lt;P&gt;addLayer = Changes_Layer +str(currentdate)&lt;/P&gt;&lt;P&gt;mxd = arcpy.mapping.MapDocument("\\\\c:\myLocation\\MyMap.mxd&lt;/P&gt;&lt;P&gt;df = arcpy.mapping.ListDataFrames(mxd, "Update")[0]&lt;/P&gt;&lt;P&gt;arcpy.mapping.AddLayer(df, addLayer, "TOP")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 13:27:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191118#M14677</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-11-03T13:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191119#M14678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The script also corrupts my mxd to the point I cannot save it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 14:35:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191119#M14678</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-11-03T14:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191120#M14679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have you tried this on a local drive to rule out network issues?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 18:31:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191120#M14679</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-03T18:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191121#M14680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes it's on a network and I will have to try it locally and work from there.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 18:36:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191121#M14680</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-11-03T18:36:29Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191122#M14681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Got the same error message.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 18:43:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191122#M14681</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-11-03T18:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191123#M14682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;haven't played around with adding to arcmap and arcpy mapping when it is not open, however, I see a potential issue.&amp;nbsp; The help file suggests that when using wildcards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="k"&gt;for&lt;/SPAN&gt; &lt;SPAN class="n"&gt;df&lt;/SPAN&gt; &lt;SPAN class="ow"&gt;in&lt;/SPAN&gt; &lt;SPAN class="n"&gt;arcpy&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;mapping&lt;/SPAN&gt;&lt;SPAN class="o"&gt;.&lt;/SPAN&gt;&lt;SPAN class="n"&gt;ListDataFrames&lt;/SPAN&gt;&lt;SPAN class="p"&gt;(&lt;/SPAN&gt;&lt;SPAN class="n"&gt;mxd&lt;/SPAN&gt;&lt;SPAN class="p"&gt;,&lt;/SPAN&gt; &lt;SPAN class="s"&gt;"t*"&lt;/SPAN&gt;&lt;SPAN class="p"&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you cycle through the list (even if it is one entry) without slicing.&amp;nbsp; Your script&amp;nbsp; uses&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="arcpyref"&gt;&lt;/SPAN&gt;df = arcpy.mapping.ListDataFrames(mxd, "Update")[0]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and the error message suggests that there are no dataframes called "Update", so you might check this and/or use a wildcard "Update*" to see if that works.&amp;nbsp; That is what the index out of range means there is no first entry in the list and the list is empty&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 19:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191123#M14682</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-11-03T19:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Send a feature to a map using Python</title>
      <link>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191124#M14683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Found the error to be the dataframe was not named properly in the properties of the mxd.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 19:28:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/send-a-feature-to-a-map-using-python/m-p/191124#M14683</guid>
      <dc:creator>StephenEldridge</dc:creator>
      <dc:date>2014-11-03T19:28:19Z</dc:date>
    </item>
  </channel>
</rss>

