源代码如下:当运行到最后一个pSaveAs
. SaveAs
...然后计算机说“无法复制光栅dataset
”。
源代码如下:
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");
}