<?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 Possible bug: IRasterClassifyColorRampRenderer symbology vs break order in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/possible-bug-irasterclassifycolorramprenderer/m-p/512615#M13823</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've written my own code to export a ClassBreaks XML file from a classified value raster layer in ArcMap (10.1), that actually also saves the color information and not just the break values alone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the part that matters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IRasterClassifyColorRampRenderer classifiedRenderer = (IRasterClassifyColorRampRenderer)rasterLayer.Renderer;
using (XmlWriter writer = XmlWriter.Create(xmlFile))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartDocument();
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartElement("ClassBreaks");
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; classifiedRenderer.ClassCount; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartElement("break");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFillSymbol symbology = (IFillSymbol)classifiedRenderer.get_Symbol(i); &amp;lt;&amp;lt;-- This does not return the symbology that matches the same break!
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteElementString("value", classifiedRenderer.get_Break(i + 1).ToString()); //we want the upper break value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteElementString("color", symbology.Color.RGB.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndElement();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndElement();
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndDocument();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What actually happens, is that the symbology (or at least the color I'm trying to retrieve) has been flipped for some reason. When I ask for the first item in the renderer, I get the first break value and the LAST symbol. For the second one I get the second last symbol and so on. In my resulting XML file, I end up with the break values in the order I want, but the colors are in reverse order.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the moment, I "fixed" this by doing something like this to get the symbol that actually belongs to the break value:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFillSymbol symbology = (IFillSymbol)classifiedRenderer.get_Symbol(classifiedRenderer.ClassCount - 1 - i);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But this is just weird.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something wrong in my code (I certainly don't see it) or is there a bug in the IRasterClassifyColorRampRenderer interface?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 31 May 2013 16:08:52 GMT</pubDate>
    <dc:creator>SanderSchaminee</dc:creator>
    <dc:date>2013-05-31T16:08:52Z</dc:date>
    <item>
      <title>Possible bug: IRasterClassifyColorRampRenderer symbology vs break order</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/possible-bug-irasterclassifycolorramprenderer/m-p/512615#M13823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've written my own code to export a ClassBreaks XML file from a classified value raster layer in ArcMap (10.1), that actually also saves the color information and not just the break values alone.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the part that matters:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;IRasterClassifyColorRampRenderer classifiedRenderer = (IRasterClassifyColorRampRenderer)rasterLayer.Renderer;
using (XmlWriter writer = XmlWriter.Create(xmlFile))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartDocument();
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartElement("ClassBreaks");
&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt; classifiedRenderer.ClassCount; i++)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartElement("break");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFillSymbol symbology = (IFillSymbol)classifiedRenderer.get_Symbol(i); &amp;lt;&amp;lt;-- This does not return the symbology that matches the same break!
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteElementString("value", classifiedRenderer.get_Break(i + 1).ToString()); //we want the upper break value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteElementString("color", symbology.Color.RGB.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndElement();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndElement();
&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndDocument();
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What actually happens, is that the symbology (or at least the color I'm trying to retrieve) has been flipped for some reason. When I ask for the first item in the renderer, I get the first break value and the LAST symbol. For the second one I get the second last symbol and so on. In my resulting XML file, I end up with the break values in the order I want, but the colors are in reverse order.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For the moment, I "fixed" this by doing something like this to get the symbol that actually belongs to the break value:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IFillSymbol symbology = (IFillSymbol)classifiedRenderer.get_Symbol(classifiedRenderer.ClassCount - 1 - i);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But this is just weird.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there something wrong in my code (I certainly don't see it) or is there a bug in the IRasterClassifyColorRampRenderer interface?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Sander&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 31 May 2013 16:08:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/possible-bug-irasterclassifycolorramprenderer/m-p/512615#M13823</guid>
      <dc:creator>SanderSchaminee</dc:creator>
      <dc:date>2013-05-31T16:08:52Z</dc:date>
    </item>
  </channel>
</rss>

