How to access raster workspaces

Rasters can reside in a folder, a personal geodatabase, a file geodatabase, or an ArcSDE geodatabase. This article shows you how to open different types of workspaces as a raster workspace.

Accessing raster workspaces

All geodatabase workspaces support the IRasterWorkspaceEx interface, while file workspaces support IRasterWorkspace. See the following code example:
//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 licensingDeployment licensing
ArcGIS for Desktop BasicArcGIS for Desktop Basic
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
Engine Developer KitEngine