<?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 Should be a simple IRasterLayer question... in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/should-be-a-simple-irasterlayer-question/m-p/99513#M2640</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Given that I have a valid raster "mExtractedraster"...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

IRasterLayer rasterLayer = new RasterLayerClass();
rasterLayer.CreateFromRaster(mExtractedRaster);

// Customize how the raster renders.
IRasterStretchColorRampRenderer mRenderer = new RasterStretchColorRampRenderer();
mRenderer.ColorScheme = "Blue Light to Dark";

rasterLayer.Renderer = (IRasterRenderer)mRenderer;

// Compute the statistics for the raster.
IRasterCalcStatsHistogram m_calcStats = new RasterCalcStatsHistogramClass();
IStatsHistogram m_stHisto = new StatsHistogramClass();

m_calcStats.ComputeFromRaster(rasterLayer.Raster, 1, m_stHisto);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
mapControl.AddLayer(rasterLayer);
mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...this code should correctly display the raster layer in the map control using the correct renderer.&amp;nbsp; If I use the identify tool to explore the raster layer, I am getting the correct cell values however the raster looks like one that does not contain any statistics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Feb 2012 02:09:53 GMT</pubDate>
    <dc:creator>DonaldBrandon1</dc:creator>
    <dc:date>2012-02-15T02:09:53Z</dc:date>
    <item>
      <title>Should be a simple IRasterLayer question...</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/should-be-a-simple-irasterlayer-question/m-p/99513#M2640</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Given that I have a valid raster "mExtractedraster"...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

IRasterLayer rasterLayer = new RasterLayerClass();
rasterLayer.CreateFromRaster(mExtractedRaster);

// Customize how the raster renders.
IRasterStretchColorRampRenderer mRenderer = new RasterStretchColorRampRenderer();
mRenderer.ColorScheme = "Blue Light to Dark";

rasterLayer.Renderer = (IRasterRenderer)mRenderer;

// Compute the statistics for the raster.
IRasterCalcStatsHistogram m_calcStats = new RasterCalcStatsHistogramClass();
IStatsHistogram m_stHisto = new StatsHistogramClass();

m_calcStats.ComputeFromRaster(rasterLayer.Raster, 1, m_stHisto);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
mapControl.AddLayer(rasterLayer);
mapControl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;...this code should correctly display the raster layer in the map control using the correct renderer.&amp;nbsp; If I use the identify tool to explore the raster layer, I am getting the correct cell values however the raster looks like one that does not contain any statistics.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ideas?&amp;nbsp; Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Feb 2012 02:09:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/should-be-a-simple-irasterlayer-question/m-p/99513#M2640</guid>
      <dc:creator>DonaldBrandon1</dc:creator>
      <dc:date>2012-02-15T02:09:53Z</dc:date>
    </item>
  </channel>
</rss>

