1

For rasters that are above 16-bit - you cannot apply a colormap. So what is happening when you symbolise in ArcMap a 32 bit raster - it's certainly possible. I'm trying to emulate this funcitonality in ArcObjects - but at the moment I'm getting a bit muddled. Can anyone lend a hand here?

CODE - not working.

IRasterDataset rasterDataset = null;
IRasterLayer rasterLayer = new RasterLayerClass();
rasterDataset = GeodatabaseManager.RasterWorkapaceEx.OpenRasterDataset("fooRaster");


IRasterStretchColorRampRenderer rasterStretchColorRampRenderer = new RasterStretchColorRampRendererClass();
IRasterRenderer rasterRenderer = (IRasterRenderer)rasterStretchColorRampRenderer;
IRasterStretch rasterStretch = (IRasterStretch)rasterStretchColorRampRenderer;
rasterStretch.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_MinimumMaximum;
IRaster raster = (IRaster)rasterDataset.CreateDefaultRaster();
rasterRenderer.Raster = raster;

IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRampClass();
colorRamp.Size = 255;
colorRamp.FromColor = CreateRGBColor(0, 0, 255);
colorRamp.ToColor = CreateRGBColor(255, 0, 0);
bool createColorRamp;
colorRamp.CreateRamp(out createColorRamp);

rasterStretchColorRampRenderer.BandIndex = 0;
rasterStretchColorRampRenderer.ColorRamp = colorRamp;

rasterRenderer.Update();
rasterLayer.CreateFromDataset(rasterDataset);
ILayer layer = (ILayer)rasterLayer;
ArcMap.Document.FocusMap.AddLayer(layer);

closed as unclear what you're asking by Fezter, PolyGeo Mar 14 '16 at 2:38

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Precisely what have you tried and where are you stuck? Can you edit your question to include a code snippet, please? – PolyGeo Mar 2 '15 at 10:01