Reputation: 1
The source code are following:
when run into the last pSaveAs
.SaveAs
... then the computer say "failed to copy raster dataset
".
The source code are following:
private void SaveRaster(IRasterDataset2 mygeoDataset,string sFormat,string filePath,string fileName )
{
`ISaveAs2` pSaveAs = mygeoDataset as ISaveAs2;
if(!pSaveAs.CanSaveAs(sFormat))
{
MessageBox.Show("no support file type");
return;
}
IWorkspaceFactory pworspaceFactory = new RasterWorkspaceFactoryClass();
IWorkspace pWorkspace = null;
pWorkspace = pworspaceFactory.OpenFromFile(filePath, 0);
pSaveAs.SaveAs(fileName, pWorkspace, "GRID");
}
Upvotes: 0
Views: 103