I have a CostDistanceCode that works correctly. I cannot cast the IGeoDataset result into a raster. The last line returns a null raster. How can I resolve this?
// Declare the output raster object
//Note: Adjust the IDistanceOp.CostDistance method options to suit your applications need.
IDistanceOp distanceOp = new RasterDistanceOpClass();
object object_missing1 = System.Type.Missing;
object object_missing2 = System.Type.Missing;
IFeatureClass in_source_Featuer2 = null;
ClsGeneral.OpenFeatureClass(cmbSource.SelectedValue.ToString(), cmbSource.Text, out in_source_Featuer2);
IRaster backlinkraster = new Raster();
IGeoDataset g1 = in_source_Featuer2 as IGeoDataset;
IGeoDataset g2 = rasOut as IGeoDataset;
IGeoDataset geoDataset_output = distanceOp.CostDistance(g1, g2, ref object_missing1, ref object_missing2);
IRasterDataSet raster_out = geoDataset_output as IRasterDataSet ;
IRaster
instead of anIRasterDataSet
?