PROBLEM
When the parameters for creating a plan and a profile are set to true in the
ISurfaceOp::Curvature method, the output is a raster that references three raster datasets. If only one of the plan or profile parameters is set to true, the output is a raster that references two raster datasets. If the output raster is added directly to ArcMap, it displays blank.
This is a known issue with ArcGIS 8.1.
Code:
Sub AddResultOfCurvatureAsLayer(pResultOfCurvature As IRaster, pMap As IMap)
' pResultOfCurvature: the output from Curvature operation
' pMap: the Map object obtained from ThisDocument
Dim pRasBandC As IrasterBandCollection
' QI IRasterBandCollection interface
Set pRasBandC = pResultOfCurvature
Dim pRasBand As IRasterBand
Dim pOutRasterDS As IRasterDataset
Dim pOutRaster As IRaster
Dim pNewLayer As IRasterLayer
Dim BandCount, I As Integer
' Get the number of raster bands
BandCount = pRasBandC.Count
' Add each band as a layer to ArcMap
For I = 0 To BandCount - 1
Set pRasBand = pRasBandC.Item(I)
Set pOutRasterDS = pRasBand.RasterDataset
Set pOutRaster = pOutRasterDS.CreateDefaultRaster
Set pNewLayer = New RasterLayer
pNewLayer.CreateFromRaster pOutRaster
pMap.AddLayer pNewLayer
Next I
End Sub
Get help from ArcGIS experts
Download the Esri Support App