How to access a raster dataset or raster catalog


Summary This article shows how to open a raster dataset (file based or in a geodatabase) or a raster catalog.

Accessing a raster dataset or raster catalog

A raster dataset can be stored as file based or in a geodatabase. However, a raster catalog can only be stored in a geodatabase. There is a difference between accessing a file-based raster dataset and a raster dataset in a geodatabase.
When accessing a file-based raster dataset, IRasterWorkspace is used. See the following code example:
[Java]
static IRasterDataset openFileRasterDataset(String folderName, String datasetName)
    throws Exception{
    // Open raster file workspace.
    IWorkspaceFactory workspaceFactory = new RasterWorkspaceFactory();
    IRasterWorkspace rasterWorkspace = new IRasterWorkspaceProxy
        (workspaceFactory.openFromFile(folderName, 0));

    // Open file raster dataset.
    IRasterDataset rasterDataset = rasterWorkspace.openRasterDataset(datasetName);
    return rasterDataset;
}
When accessing a raster dataset in a geodatabase, IRasterWorkspaceEx should be used. See the following code example:
[Java]
static IRasterDataset openGDBRasterDataset(IRasterWorkspaceEx rasterWorkspaceEx,
    String datasetName)throws Exception{
    // Open a raster dataset in a geodatabase including PGDB, FGDB, and
    // ArcSDE.
    return rasterWorkspaceEx.openRasterDataset(datasetName);
}
A raster catalog can only be stored in a geodatabase. See the following code example:
[Java]
static IRasterCatalog openRasterCatalog(IRasterWorkspaceEx rasterWorkspaceEx, String
    catalogName)throws Exception{
    // Open a raster catalog in a geodatabase including PGDB, FGDB, and
    // ArcSDE.
    return rasterWorkspaceEx.openRasterCatalog(catalogName);
}


See Also:

How to access a raster dataset in a raster catalog




Development licensing Deployment licensing
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo
Engine Developer Kit Engine Runtime