how to add dynamically tif raster layer to Toc and display in Map control in web

745
0
11-16-2012 03:43 PM
lihong1
New Contributor
My Environment is : win2003, arcserver9.3 ,sde

question:
I Want to add a Raster(.TIFF) Image as a Layer in TOC on ArcGIS Server of win2003. (This tif file is one common file and not be imported in sde database)
2 NOw I can  add tiff file in TOC, but it is not displying tha on Map. (Means It is not Rendering).
3 following is the code which i have written. I am delayed for over than for one month so that I only post this problem in this website for help.
4 I m in great need of this.

my code:  (these codes can run in web server but raster layer can display picture in Map1 control of web page)
IWorkspaceFactory rasterWorkspaceFactory = new RasterWorkspaceFactoryClass();

            IRasterWorkspace rasterWorkspace = (IRasterWorkspace)rasterWorkspaceFactory.OpenFromFile(@"E:/Data", 0);
            IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset("newdem");   //file name

            IRasterLayer rasterLayer = new RasterLayerClass();

            rasterLayer.CreateFromDataset(rasterDataset);

            axMapControl1.AddLayer(rasterLayer, 0);
0 Kudos
0 Replies