Home    |    Concepts   |   API   |   Samples
Concepts > Rasters > Data Retrieval
Retrieving an image

Retrieving an image from a raster

To retrieve a raster image from a raster column, usual query methods should be employed.
 
CONTENT

//Step 1. Create a SeQuery and SeRow
SeRasterColumn rasterLayer = ........;
SeQuery query = new SeQuery(conn, cols, sqlConstruct);
query.prepareQuery();
query.execute();

SeRow row = query.fetch();

//Step 2. Retrieve column definition and type from SeRow
SeColumnDefinition colDef = row.getColumnDef(rasterColumnNumber);
int type = colDef.getType();

//Step 3. Retrieve layer Id from raster column, create a new SeRaster, get bands.
//if type is Raster
SeObjectId rasterLayerId = rasterLayer.getID();
SeRaster raster = new SeRaster(conn, rasterLayerId);
image.setRasterId(new SeObjectId(rasterId));
SeRasterBand[] rasBands = raster.getBands();
query.close();

 

When retrieving raster information such as raster bands and raster ID from an ArcSDE server, the SeRaster.getInfoById() method should be called before calling any SeRaster.getXXX() method. This method retrieves raster information from the server into a local buffer, which is then used by all SeRaster.getXXX() methods.

CONTENT

//Step 1. Create a SeQuery and SeRow
SeRasterColumn rasterLayer = ........;
SeQuery query = new SeQuery(conn, cols, sqlConstruct);
query.prepareQuery();
query.execute();

SeRow row = query.fetch();

//Step 2. Retrieve column definition and type from SeRow
SeColumnDefinition colDef = row.getColumnDef(rasterColumnNumber);
int type = colDef.getType();

//Step 3. Retrieve layer Id from raster column, create a new SeRaster, get bands.
//if type is Raster
SeObjectId rasterLayerId = rasterLayer.getID();
SeRaster raster = new SeRaster(conn, rasterLayerId);
image.setRasterId(new SeObjectId(rasterId));
SeRasterBand[] rasBands = raster.getBands();
query.close();

1 ?SeObjectId lastInsertId = insert.lastInsertedRasterId(); 2 ?...... 3 ?....... 4 ?raster.getInfoById(lastInsertId); 5 ?SeRasterBand[] bands = raster.getBands();


feedback | privacy | legal