应该是给的参数不对,应该是完整路径吧,你这个有文件名吗?
public ESRI.ArcGIS.Geodatabase.IGeoDataset OpenRasterFileAsGeoDatset(System.String path, System.String name){
try
{
ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesRaster.RasterWorkspaceFactoryClass()
ESRI.ArcGIS.DataSourcesRaster.IRasterWorkspace rasterWorkspace = (ESRI.ArcGIS.DataSourcesRaster.IRasterWorkspace)(workspaceFactory.OpenFromFile(path, 0))
ESRI.ArcGIS.Geodatabase.IRasterDataset rasterDataset = rasterWorkspace.OpenRasterDataset(name)
ESRI.ArcGIS.Geodatabase.IGeoDataset geoDataset = (ESRI.ArcGIS.Geodatabase.IGeoDataset)rasterDataset // Explicit Cast
return geoDataset
}
catch (System.Exception ex)
{
//System.Diagnostics.Debug.WriteLine(ex.Message)
return null
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)