<?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 adding a feture class / layer to an existing map ducument using python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282492#M21790</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone tell me the best way to add data points into an existing mxd document within a python script.&lt;/P&gt;&lt;P&gt;I can create a feature set with the points in python but do not know if I should create an xy event layer, or an in memory layer and then add it to the mxd then symbolize and label the points somehow for display on the map output.&amp;nbsp; The documentation on this seems limited and I have tried several times but cannot get anything to add to the mxd document in python.&amp;nbsp; Any help on this would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Aug 2014 13:07:49 GMT</pubDate>
    <dc:creator>Michael_LesBober</dc:creator>
    <dc:date>2014-08-20T13:07:49Z</dc:date>
    <item>
      <title>adding a feture class / layer to an existing map ducument using python</title>
      <link>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282492#M21790</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone tell me the best way to add data points into an existing mxd document within a python script.&lt;/P&gt;&lt;P&gt;I can create a feature set with the points in python but do not know if I should create an xy event layer, or an in memory layer and then add it to the mxd then symbolize and label the points somehow for display on the map output.&amp;nbsp; The documentation on this seems limited and I have tried several times but cannot get anything to add to the mxd document in python.&amp;nbsp; Any help on this would be greatly appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 13:07:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282492#M21790</guid>
      <dc:creator>Michael_LesBober</dc:creator>
      <dc:date>2014-08-20T13:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: adding a feture class / layer to an existing map ducument using python</title>
      <link>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282493#M21791</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you trying to this through arcpy.mapping? if so see &lt;A _jive_internal="true" href="https://community.esri.com/message/293217?sr=search&amp;amp;searchId=2bad7f53-d5ed-45e1-b9ec-d27f3c40ec85&amp;amp;searchIndex=4#293217"&gt;this thread&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 13:15:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282493#M21791</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2014-08-20T13:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: adding a feture class / layer to an existing map ducument using python</title>
      <link>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282494#M21792</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try below script, this creates an event layer and adds it to an MXD file. You can use UniqueValuesSymbology class in mapping module to build your symbology &lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000005s000000" title="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000005s000000"&gt;ArcGIS Help 10.1&lt;/A&gt;‌&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14085425768893033" jivemacro_uid="_14085425768893033"&gt;
&lt;P&gt;import arcpy&lt;/P&gt;
&lt;P&gt;import os&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;table = r"C:\Users\deenr\Desktop\Data.xlsx\Sheet1$"&lt;/P&gt;
&lt;P&gt;layerName = "EVENT_LAYER"&lt;/P&gt;
&lt;P&gt;# Temp layer file location&lt;/P&gt;
&lt;P&gt;lyrFile = r"C:\Users\deenr\Desktop\delete_event_layer.lyr"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# IMPORTANT, set your spatial reference&lt;/P&gt;
&lt;P&gt;sRef = ""&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;arcpy.MakeXYEventLayer_management(table, "X", "Y", layerName, sRef, "")&lt;/P&gt;
&lt;P&gt;arcpy.SaveToLayerFile_management(layerName, lyrFile)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Create Layer object&lt;/P&gt;
&lt;P&gt;layer = arcpy.mapping.Layer(lyrFile)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# Open MXD&lt;/P&gt;
&lt;P&gt;mxd = arcpy.mapping.MapDocument(r"C:\Users\deenr\Desktop\forum_delete_1.mxd")&lt;/P&gt;
&lt;P&gt;# Get your first data frame&lt;/P&gt;
&lt;P&gt;df = arcpy.mapping.ListDataFrames(mxd)[0]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;# add layer and save MXD&lt;/P&gt;
&lt;P&gt;arcpy.mapping.AddLayer(df, layer)&lt;/P&gt;
&lt;P&gt;mxd.save()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;#Delete layer file&lt;/P&gt;
&lt;P&gt;os.remove(lyrFile)&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Aug 2014 13:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adding-a-feture-class-layer-to-an-existing-map/m-p/282494#M21792</guid>
      <dc:creator>RiyasDeen</dc:creator>
      <dc:date>2014-08-20T13:51:49Z</dc:date>
    </item>
  </channel>
</rss>

