IDataset SaveAs (string Name,IWorkspace Workspace,string Format);
本人亲测经验:保存的路径中不要有中文字符,grid格式遇到中文字符就一个字坑坑坑,之前用给grid格式的数据修改投影也是因为中文字的问题修改失败。
1.参数Name注意事项
1)字符数不能超过13个
2)可以包含a-z ,A-Z ,0-9 ,“-”“_”. (这个都是一样)
3)必须以字母开头
2.传一个输出路径的工作空间即可 (RasterWorkspace)
3.Fromat:
The format strings used for the supported formats are below, and they are case sensitive:
Format Name | String Used |
---|---|
Imagine | "IMAGINE Image" |
TIFF | "TIFF" |
GRID | "GRID" |
JPEG | "JPG" |
JP2000 | "JP2" |
BMP | "BMP" |
PNG | "PNG" |
GIF | "GIF" |
PCI Raster | "PIX" |
X11 Pixmap | "XPM" |
PCRaster | "MAP" |
Memory Raster | "MEM" |
HDF4 | "HDF4" |
BIL | "BIL" |
BIP | "BIP" |
BSQ | "BSQ" |
Idrisi Raster Format | "RST" |
ENVI Raster Format | "ENVI" |
Geodatabase Raster | "GDB" |
Note, SaveAs will return a RasterDataset, to prevent from ISaveAs holding the output, .NET ReleaseCOMObject needs to be called to release the referene to the output raster dataset:
System.Runtime.InteropServices.Marshal.ReleaseComObject(outRasterDS);
帮助的意思通俗的讲就是:拉完屎记得擦屁股(记得释放掉你生成的Dataset)