I'm using IExtractionOp to clip a raster by polygon:
IExtractionOp operation = (IExtractionOp)(new RasterExtractionOp()); IRasterBandCollection rasterBandCollection = (IRasterBandCollection)operation.Polygon((IGeoDataset)rasterDataset, polygon, true);
I tried saving via
// Fails with exception IRasterDataset dataset = rasterBandCollection.Item(0).RasterDataset; dataset.Copy("temp" + extension, (IWorkspace)rasterWorkspace); // Successful, but does not show any pixels in ArcMap when opened rasterBandCollection.SaveAs("temp" + extension, (IWorkspace)rasterWorkspace, rasterDataset.Format); // Same result as SaveAs ((ITemporaryDataset)dataset).MakePermanentAs("temp" + extension, (IWorkspace)rasterWorkspace, rasterDataset.Format);
None of the three methods above worked... I can use the returned result and add it to the map, so the extraction seems to be valid, but I'm unable to store it anyhow.