<?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: addDataFromPath not adding outputs to map in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1216775#M67772</link>
    <description>&lt;P&gt;check the code examples&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/map-class.htm" target="_blank"&gt;Map—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If the code is as you show it, then layer_name and input_gdb won't be known&lt;/P&gt;</description>
    <pubDate>Tue, 27 Sep 2022 22:20:13 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-09-27T22:20:13Z</dc:date>
    <item>
      <title>addDataFromPath not adding outputs to map</title>
      <link>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1216618#M67771</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;When I run the addDataFromPath command, python prints "&amp;lt;arcpy._mp.Layer object at 0x000002658CF55948&amp;gt;" rather than adding anything to the map. I have '&lt;SPAN&gt;arcpy.env.addOutputsToMap' set to 'True'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is a sample of my script:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;layer_name = "layer"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Input_gdb = "gdb"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;aprx = arcpy.mp.ArcGISProject(InputProject)&lt;BR /&gt;m = aprx.listMaps('Map')[0]&lt;/P&gt;&lt;P&gt;m.addDataFromPath(Input_gdb + "\\" + layer_name)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 17:14:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1216618#M67771</guid>
      <dc:creator>OwenKirkham</dc:creator>
      <dc:date>2022-09-27T17:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: addDataFromPath not adding outputs to map</title>
      <link>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1216775#M67772</link>
      <description>&lt;P&gt;check the code examples&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/map-class.htm" target="_blank"&gt;Map—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If the code is as you show it, then layer_name and input_gdb won't be known&lt;/P&gt;</description>
      <pubDate>Tue, 27 Sep 2022 22:20:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1216775#M67772</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-09-27T22:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: addDataFromPath not adding outputs to map</title>
      <link>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1543924#M72964</link>
      <description>&lt;P&gt;I am having the same problem as&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/611393"&gt;@OwenKirkham&lt;/a&gt;&amp;nbsp;when I try to do this in python outside of arcgis pro (being careful to run it with Pro's python environment).&amp;nbsp; Here's the code:&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;project = arcpy.mp.ArcGISProject (r'fullPathToProject')&lt;/P&gt;&lt;P&gt;m = project.listMaps()[0]&lt;/P&gt;&lt;P&gt;m.addDataFromPath(project.defaultGeodatabase + r'\featureClassName')&lt;/P&gt;&lt;P&gt;The output generated from this last line is the same as Owen's (with a different memory address of course).&amp;nbsp; I have also tried the .addDataFromPath line copying the entire path to the feature class instead of using project.defaultGeodatabase and the result is the same, but in both cases the 'featureClassName' data was not added to the map.&amp;nbsp; I also checked arpcy.end.addOutputsToMap and found that it was already True.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any thoughts on what could be wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 18:04:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1543924#M72964</guid>
      <dc:creator>MichaelMarlatt1</dc:creator>
      <dc:date>2024-09-30T18:04:49Z</dc:date>
    </item>
    <item>
      <title>Re: addDataFromPath not adding outputs to map</title>
      <link>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1543933#M72965</link>
      <description>&lt;P&gt;Someone in another thread solved it (for the standalone scenario anyway).&amp;nbsp; Adding a line to the above code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;project.save()&lt;/P&gt;&lt;P&gt;did the trick.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 18:27:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/adddatafrompath-not-adding-outputs-to-map/m-p/1543933#M72965</guid>
      <dc:creator>MichaelMarlatt1</dc:creator>
      <dc:date>2024-09-30T18:27:28Z</dc:date>
    </item>
  </channel>
</rss>

