<?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.mapping.UpdateLayer vs arcpy.ApplySymbologyFromLayer in Geoprocessing Questions</title>
    <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-mapping-updatelayer-vs-arcpy/m-p/269178#M9280</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to change the symbology of a raster so that it matches a .lyr file I have stashed away. Once the symbology is set I will read the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000005p000000" rel="nofollow" target="_blank"&gt;classBreakValues&lt;/A&gt;&lt;SPAN&gt; and build a &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/RemapRange/005m0000007m000000/" rel="nofollow" target="_blank"&gt;RemapRange&lt;/A&gt;&lt;SPAN&gt; so that I can reclassify the raster cell values using &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000sr000000" rel="nofollow" target="_blank"&gt;Reclassify&lt;/A&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would prefer to do this via &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Apply_Symbology_From_Layer/00170000006n000000/" rel="nofollow" target="_blank"&gt;arcpy.ApplySymbologyFromLayer&lt;/A&gt;&lt;SPAN&gt; because it allows me to work outside of an MXD. The problem is that it doesn't seem to apply the symbology correctly. My .lyr file symbology uses the Standard Deviation classification method with 3 classes but when I run ApplySymbologyFromLayer the result always has 4 classes, even when I apply the symbology to the original source raster I used to create the .lyr file. Attempting to set the numClasses = 3 after applying the symbology doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Conversely, &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000003p000000" rel="nofollow" target="_blank"&gt;arcpy.mapping.UpdateLayer&lt;/A&gt;&lt;SPAN&gt; applies the symbology correctly but requires an mxd and dataframe as input parameters. I want to minimize file dependencies and would prefer not to have dummy .mxd's laying around, which is what I need in order to use UpdateLayer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, why does a single .lyr file produce two different results when applied to the same dataset via UpdateLayer and ApplySymbologyFromLayer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script will be used by many users on many different rasters and I really, really, really, don't want to have dummy .mxd's stashed around our network. Is there any way to avoid this? I would prefer not to have a file dependency on the .lyr file either; does anyone see a way around that? Shouldn't there be a classificationMethod property so I can do something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.classificationMethod = standard_deviation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.numClasses = 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.reclassify()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Feb 2013 19:32:59 GMT</pubDate>
    <dc:creator>RyanClancy</dc:creator>
    <dc:date>2013-02-05T19:32:59Z</dc:date>
    <item>
      <title>arcpy.mapping.UpdateLayer vs arcpy.ApplySymbologyFromLayer</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-mapping-updatelayer-vs-arcpy/m-p/269178#M9280</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I want to change the symbology of a raster so that it matches a .lyr file I have stashed away. Once the symbology is set I will read the &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000005p000000" rel="nofollow" target="_blank"&gt;classBreakValues&lt;/A&gt;&lt;SPAN&gt; and build a &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/RemapRange/005m0000007m000000/" rel="nofollow" target="_blank"&gt;RemapRange&lt;/A&gt;&lt;SPAN&gt; so that I can reclassify the raster cell values using &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//009z000000sr000000" rel="nofollow" target="_blank"&gt;Reclassify&lt;/A&gt;&lt;SPAN&gt;. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would prefer to do this via &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#/Apply_Symbology_From_Layer/00170000006n000000/" rel="nofollow" target="_blank"&gt;arcpy.ApplySymbologyFromLayer&lt;/A&gt;&lt;SPAN&gt; because it allows me to work outside of an MXD. The problem is that it doesn't seem to apply the symbology correctly. My .lyr file symbology uses the Standard Deviation classification method with 3 classes but when I run ApplySymbologyFromLayer the result always has 4 classes, even when I apply the symbology to the original source raster I used to create the .lyr file. Attempting to set the numClasses = 3 after applying the symbology doesn't work. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Conversely, &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s30000003p000000" rel="nofollow" target="_blank"&gt;arcpy.mapping.UpdateLayer&lt;/A&gt;&lt;SPAN&gt; applies the symbology correctly but requires an mxd and dataframe as input parameters. I want to minimize file dependencies and would prefer not to have dummy .mxd's laying around, which is what I need in order to use UpdateLayer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, why does a single .lyr file produce two different results when applied to the same dataset via UpdateLayer and ApplySymbologyFromLayer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script will be used by many users on many different rasters and I really, really, really, don't want to have dummy .mxd's stashed around our network. Is there any way to avoid this? I would prefer not to have a file dependency on the .lyr file either; does anyone see a way around that? Shouldn't there be a classificationMethod property so I can do something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.classificationMethod = standard_deviation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.numClasses = 3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;layer.symbology.reclassify()&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2013 19:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-mapping-updatelayer-vs-arcpy/m-p/269178#M9280</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2013-02-05T19:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: arcpy.mapping.UpdateLayer vs arcpy.ApplySymbologyFromLayer</title>
      <link>https://community.esri.com/t5/geoprocessing-questions/arcpy-mapping-updatelayer-vs-arcpy/m-p/269179#M9281</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Since I don't need a visual output (i.e. a map) I decided to do away with the ArcGIS symbol render and do the classification myself. I break the data into three classes using standard deviation like so:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; def Reclass(value) &amp;nbsp;&amp;nbsp;&amp;nbsp; rasterSTD = arcpy.GetRasterProperties_management(my_raster, "STD") &amp;nbsp;&amp;nbsp;&amp;nbsp; std = rasterSTD.getOutput(0) &amp;nbsp;&amp;nbsp;&amp;nbsp; rasterMEAN = arcpy.GetRasterProperties_management(my_raster, "MEAN") &amp;nbsp;&amp;nbsp;&amp;nbsp; mean = rasterMEAN.getOutput(0)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; diff = abs(value - mean)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; if (diff &amp;lt; std): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 1 &amp;nbsp;&amp;nbsp;&amp;nbsp; elif ((diff &amp;gt; std) &amp;amp; (diff &amp;lt; 2*std)): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 2 &amp;nbsp;&amp;nbsp;&amp;nbsp; elif (diff &amp;gt; 2*std): &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 3&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...presto! This has solved my file dependency (.lyr &amp;amp; .mxd) issue as well as the inconsistent results between ApplySymbologyFromLayer vs arcpy.mapping.UpdateLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Feb 2013 19:22:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/geoprocessing-questions/arcpy-mapping-updatelayer-vs-arcpy/m-p/269179#M9281</guid>
      <dc:creator>RyanClancy</dc:creator>
      <dc:date>2013-02-06T19:22:34Z</dc:date>
    </item>
  </channel>
</rss>

