Accessing raster workspaces
All geodatabase workspaces support the IRasterWorkspaceEx interface, while file workspaces support IRasterWorkspace. See the following code example:
[Java]
//Open file geodatabase workspace as RasterWorkspace.
static IRasterWorkspaceEx openFGDB(String FGDBPath)throws Exception{
//FGDBPath String example: c:\data\raster.gdb.
IWorkspaceFactory2 workspaceFactory = new FileGDBWorkspaceFactory();
return new IRasterWorkspaceExProxy(workspaceFactory.openFromFile(FGDBPath, 0));
}
//Open ArcSDE workspace as RasterWorkspace.
static IRasterWorkspaceEx OpenSDE(String conString)throws Exception{
//conString example: SERVER=qian;INSTANCE=9200;VERSION=sde.DEFAULT;USER=raster;PASSWORD=raster.
IWorkspaceFactory2 workspaceFactory = new SdeWorkspaceFactory();
return new IRasterWorkspaceExProxy(workspaceFactory.openFromString(conString, 0))
;
}
//Open accessed workspace as RasterWorkspace.
static IRasterWorkspaceEx OpneAccess(String PGDBPath)throws Exception{
//FGDBPath String example: c:\data\rasters.mdb.
IWorkspaceFactory2 workspaceFactory = new AccessWorkspaceFactory();
return new IRasterWorkspaceExProxy(workspaceFactory.openFromFile(PGDBPath, 0));
}
//Open file workspace as RasterWorkspace.
static IRasterWorkspace OpenFileWorkspace(String wsPath)throws Exception{
//wsPath example: c:\data\rasters.
IWorkspaceFactory workspaceFact = new RasterWorkspaceFactory();
return new IRasterWorkspaceExProxy(workspaceFact.openFromFile(wsPath, 0));
}
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |