<?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: Unexpected Behavior with arcpy.addDataFromPath in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688503#M53334</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;C:\....Your_Install_path...\Resources\ArcPy\arcpy\management.py&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__esri_toolname__
&lt;SPAN class="string token"&gt;'ApplySymbologyFromLayer_management'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__module__
&lt;SPAN class="string token"&gt;'arcpy.management'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- same&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__esri_toolname__
&lt;SPAN class="string token"&gt;'ApplySymbologyFromLayer_management'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__module__
&lt;SPAN class="string token"&gt;'arcpy.management'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- and finally&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__code__

&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;code object ApplySymbologyFromLayer at &lt;SPAN class="number token"&gt;0x00000158E26CDA50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; file

&lt;SPAN class="string token"&gt;"C:\arc_pro\Resources\ArcPy\arcpy\management.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;8520&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;

‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Lots to explore in those folders, especially the new toolbox structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;SPAN&gt;Your_Install_path...&lt;/SPAN&gt;\Resources\ArcToolBox\toolboxes\Data Management Tools.tbx\ApplySymbologyFromLayer.tool&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 04:58:13 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2021-12-12T04:58:13Z</dc:date>
    <item>
      <title>Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688501#M53332</link>
      <description>&lt;P&gt;Working on a work-around for another conundrum and tried the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import arcpy

x = some X
y = some Y

point = arcpy.Point(x,y)

ptGeometry = arcpy.PointGeometry(point)

feature_class = arcpy.CreateFeatureclass_management("in_memory", "tempfc", "POINT")[0]

with arcpy.da.InsertCursor(feature_class, ["SHAPE@XY"]) as cursor:
    cursor.insertRow(ptGeometry)

aprx = arcpy.mp.ArcGISProject("CURRENT")
symbologyLayer = r"&amp;lt;some path&amp;gt;...\someSymbology.lyrx"

arcpy.management.ApplySymbologyFromLayer(feature_class,symbologyLayer)

# Interestingly, the following works too
#arcpy.ApplySymbologyFromLayer_management(feature_class,symbologyLayer)

map = aprx.listMaps()[0]
map.addDataFromPath(feature_class)

‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/LI-CODE&gt;
&lt;P&gt;So this works great in that I'm getting a symbol plotted where I needed. But it does that three (3)&amp;nbsp; times giving me the following output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/512968_pastedImage_1.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;Now, I realize I could try and control the&amp;nbsp;place of insertion by using addLayer() and using the LYRX file directly after updating its data source. But the above output is not what I would expect based on what I'm doing. What's&amp;nbsp;going on there?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2020 18:46:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688501#M53332</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-11-19T18:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688502#M53333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Regarding these lines:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;feature_class&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;symbologyLayer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Interestingly, the following works too&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#arcpy.ApplySymbologyFromLayer_management(feature_class,symbologyLayer)&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Line #01 and Line #04 call the exact same geoprocessing tool, so you should expect them to both work.&amp;nbsp; Line #01 represents the new syntax that Esri is pushing with Pro while Line #04 represents the original/legacy syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The default for &lt;SPAN style="font-family: courier new, courier, monospace;"&gt;arcpy.env.addOutputsToMap&lt;/SPAN&gt; is True, and I am guessing you are using the defaults, so lines #10, #18, and #24 in your code snippet will all add layers to the TOC, which is what you are seeing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:58:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688502#M53333</guid>
      <dc:creator>JoshuaBixby</dc:creator>
      <dc:date>2021-12-12T04:58:09Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688503#M53334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;C:\....Your_Install_path...\Resources\ArcPy\arcpy\management.py&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__esri_toolname__
&lt;SPAN class="string token"&gt;'ApplySymbologyFromLayer_management'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__module__
&lt;SPAN class="string token"&gt;'arcpy.management'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- same&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__esri_toolname__
&lt;SPAN class="string token"&gt;'ApplySymbologyFromLayer_management'&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__module__
&lt;SPAN class="string token"&gt;'arcpy.management'&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# ---- and finally&lt;/SPAN&gt;

arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;management&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;__code__

&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;code object ApplySymbologyFromLayer at &lt;SPAN class="number token"&gt;0x00000158E26CDA50&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; file

&lt;SPAN class="string token"&gt;"C:\arc_pro\Resources\ArcPy\arcpy\management.py"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; line &lt;SPAN class="number token"&gt;8520&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;

‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Lots to explore in those folders, especially the new toolbox structure&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C:\&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;SPAN&gt;Your_Install_path...&lt;/SPAN&gt;\Resources\ArcToolBox\toolboxes\Data Management Tools.tbx\ApplySymbologyFromLayer.tool&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 04:58:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688503#M53334</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2021-12-12T04:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688504#M53335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was beginning to wonder something like this... whether some "actions" are implied.&amp;nbsp;Glad you bring &lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="background-color: #ffffff; border: 0px; font-size: 14px;"&gt;arcpy.env.addOutputsToMap&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;to my attention. Will take a look. Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2020 13:14:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688504#M53335</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-11-10T13:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688505#M53336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good stuff, Dan. This wasn't&amp;nbsp;the first time I got close to sifting through those folders. But I'll be back to the JSAPI tomorrow, so I'm doomed to a life of limited understahding!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2020 13:16:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688505#M53336</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-11-10T13:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected Behavior with arcpy.addDataFromPath</title>
      <link>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688506#M53337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On second though, this might explain why the behavior is even different&amp;nbsp;as part of a geoprocessing service... maybe server Python/arcpy has different environmental settings by defaul? I will have to look at that, too.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Nov 2020 13:21:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unexpected-behavior-with-arcpy-adddatafrompath/m-p/688506#M53337</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2020-11-10T13:21:52Z</dc:date>
    </item>
  </channel>
</rss>

