<?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 arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131215#M10195</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python script that was initially running with ArcGIS Desktop 10.0. The script runs a bunch of analysis and then creates maps and exports to jpeg images. Prior to exporting ot jpeg, the script also defines the symbology of the map layers from some pre-defined saved layer files (.lyr). Recently, the ArcGIS license was upgraded to 10.4. The scripts works fine without any errors and produces all results. However, the symbology does not render in the new maps and ArcMAP sets some default color symbologies. Also, I checked the part (arcpy.ApplySymbologyFromLayer_management) which imports the symbologies within the ArcMAP python built-in window and it works correctly. I cannot figure out where the disconnect is in my stand alone script. Please help.&lt;/P&gt;&lt;P&gt;Note: Due to company policy I cannot share the code here, but any insight into the matter will be helpful.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Nov 2017 16:01:17 GMT</pubDate>
    <dc:creator>AnanyaBaruah</dc:creator>
    <dc:date>2017-11-07T16:01:17Z</dc:date>
    <item>
      <title>arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131215#M10195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a python script that was initially running with ArcGIS Desktop 10.0. The script runs a bunch of analysis and then creates maps and exports to jpeg images. Prior to exporting ot jpeg, the script also defines the symbology of the map layers from some pre-defined saved layer files (.lyr). Recently, the ArcGIS license was upgraded to 10.4. The scripts works fine without any errors and produces all results. However, the symbology does not render in the new maps and ArcMAP sets some default color symbologies. Also, I checked the part (arcpy.ApplySymbologyFromLayer_management) which imports the symbologies within the ArcMAP python built-in window and it works correctly. I cannot figure out where the disconnect is in my stand alone script. Please help.&lt;/P&gt;&lt;P&gt;Note: Due to company policy I cannot share the code here, but any insight into the matter will be helpful.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Nov 2017 16:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131215#M10195</guid>
      <dc:creator>AnanyaBaruah</dc:creator>
      <dc:date>2017-11-07T16:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131216#M10196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you running the script in the Python window in ArcMap?&amp;nbsp; If so, are you refreshing the view before exporting your jpeg?&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;RefreshTOC&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;RefreshActiveView&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&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;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:22:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131216#M10196</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T07:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131217#M10197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the delay in replying.&lt;/P&gt;&lt;P&gt;The script works when I run in Python window in ArcMap. It renders the symbology correctly. The stand alone script does not render the symbology correctly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 20:17:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131217#M10197</guid>
      <dc:creator>AnanyaBaruah</dc:creator>
      <dc:date>2017-11-09T20:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131218#M10198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is because the standalone script knows nothing about resetting the symbology unless you are using the mapping module and saving changes to the *.mxd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Nov 2017 22:53:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131218#M10198</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2017-11-09T22:53:33Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.ApplySymbologyFromLayer_management does not define symbology within stand-alone script</title>
      <link>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131219#M10199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You mention that a "bunch of analysis" is done.&amp;nbsp; Would ArcMap be creating layers where the name changes with each run, and if so, is the script adapting to this change?&amp;nbsp;Print statements would help identify this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a sample of the code that I use with ApplySymbologyFromLayer.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy &lt;SPAN class="comment token"&gt;# if outside ArcMap&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# inside ArcMap, use "CURRENT" for document name&lt;/SPAN&gt;
mxd &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MapDocument&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;r&lt;SPAN class="string token"&gt;"C:\Path\To\map.mxd"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# layer file is in directory with mxd map document; this will be the workspace&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;env&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;workspace &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;dirname&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;filePath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# dictonary matches map layer with symbology layer file&lt;/SPAN&gt;
symbols &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'SymbolTest'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'LayerSymbology.lyr'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; layer &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ListLayers&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; symbols&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Applying symbology to layer '{}' using '{}'."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; symbols&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ApplySymbologyFromLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; symbols&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Layer '{}' not in map."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;format&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# may need to refresh map&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# arcpy.RefreshTOC()&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# arcpy.RefreshActiveView()&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# save exported jpg in directory with mxd file using mxd name&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapping&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ExportToJPEG&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;splitext&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;basename&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mxd&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;filePath&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; mxd‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/arcpy-applysymbologyfromlayer-management-does-not/m-p/131219#M10199</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T07:22:38Z</dc:date>
    </item>
  </channel>
</rss>

