Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an image catalog composed of 4 band rasters. I would like to use the same image catalog, and set custom renderers for a true color and false color combination and save each of those catalogs off as a layer file. In addition I would like to turn off the default stretch for each catalog. The code I am using is below (where lyr is a reference to a raster catalog):

                IRasterCatalogLayer rcl = lyr as IRasterCatalogLayer;

                IRasterRGBRenderer pRGB = new RasterRGBRendererClass();
                IRasterStretch pRasStretch = pRGB as IRasterStretch;
                rcl.Renderer = pRGB as IRasterRenderer;

                pRasStretch.StretchType = esriRasterStretchTypesEnum.esriRasterStretch_NONE;
                int r, g, b;
                pRGB.QueryBandIndices(out r, out g, out b);
                pRGB.UseRedBand = true;
                pRGB.RedBandIndex = 3;
                pRGB.UseGreenBand = true;
                pRGB.GreenBandIndex = 0;
                pRGB.UseBlueBand = true;
                pRGB.BlueBandIndex = 1;

                int r1, g1, b1;
                pRGB.QueryBandIndices(out r1, out g1, out b1);

                rcl.Renderer.Update();

The stretch is being applied without problem, but I cannot change the band combinations. Thoughts? Is there a better way to do this without resorting to ArcObjects to create layer files.

share|improve this question
    
Did you try following the steps in this example exactly? If you did and you get different results, I'd say it is a bug. –  Kirk Kuykendall Jul 1 '11 at 14:05
    
I cannot completley follow that example because i am dealing with a IRasterCatalogLayer instead of an IRasterLayer. The IRasterCatalogLayer does not have a Raster property that I can assign to the new IRasterRenderer. Now, I suppose I can snag the first raster in the image catalog and use that as a Raster. –  SagebrushGIS Jul 1 '11 at 14:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.