7.18 SDO_GEOR.exportTo

Format

Note:

The SDO_GEOR.exportTo subprogram in the SDO_GEOR package is deprecated.
SDO_GEOR.exportTo(
     georaster     IN SDO_GEORASTER, 
     subsetParam   IN VARCHAR2, 
     r_destFormat  IN VARCHAR2, 
     r_destType    IN VARCHAR2, 
     r_destName    IN VARCHAR2, 
     h_destFormat  IN VARCHAR2 DEFAULT NULL, 
     h_destType    IN VARCHAR2 DEFAULT NULL, 
     h_destName    IN VARCHAR2 DEFAULT NULL);

or

SDO_GEOR.exportTo(
     georaster    IN SDO_GEORASTER, 
     subsetParam  IN VARCHAR2, 
     r_destFormat IN VARCHAR2, 
     r_destBLOB   IN OUT NOCOPY BLOB);

or

SDO_GEOR.exportTo(
     georaster     IN SDO_GEORASTER, 
     subsetParam   IN VARCHAR2, 
     r_destFormat  IN VARCHAR2, 
     r_destBLOB    IN OUT NOCOPY BLOB, 
     h_destFormat  IN VARCHAR2 DEFAULT NULL, 
     h_destCLOB    IN  OUT NOCOPY CLOB DEFAULT NULL);

Description

Exports a GeoRaster object or a subset of a GeoRaster object to a file or to a BLOB object.

Parameters

georaster

GeoRaster object that will be exported.

subsetParam

String containing subset parameters, for exporting a subset of the GeoRaster object. The format and usage are as explained in Storage Parameters, although some keywords described in that section do not apply to this procedure. The following keywords are supported:

  • pLevel: Pyramid level to be exported. The default is 0.

  • cropArea: Specify the area to be exported in the format cropArea = (startRow, startCol, endRow, endCol). It identifies the upper-left (startRow, startCol) and lower-right (endRow, endCol) coordinates of a rectangular window to be exported, and raster space is assumed. If cropArea is not specified, the entire image is exported.

  • layerNumber: Layer numbers of the layers to be exported. For example, layerNumber=(3-5) exports layers 3, 4, and 5; and layerNumber=(1,3,5) exports layers 1, 3, and 5.

r_destFormat

Raster destination format. Must be one of the following: TIFF, BMP, or PNG. (JPEG and GIF are not supported for this procedure.)

r_destType

Type of destination for the export operation. Must be FILE.

r_destName

Destination file name (with full path specification) if destType is FILE. Do not specify the file extension. If you are using this procedure only to export the world file, specify a null value for this parameter.

r_destBLOB

BLOB object to hold the image file resulting from the export operation.

h_destFormat

Geoheader destination format. Must be WORLDFILE.

h_destType

Geoheader type of destination for the export operation. Must be FILE.

h_destName

Geoheader destination file name (with full path specification) if h_destType is FILE. Do not specify the file extension.

h_destCLOB

CLOB object to hold the geoheader file resulting from the export operation.

Usage Notes

Note:

This SDO_GEOR.exportTo procedure is not supported in Oracle Autonomous Database in both shared and dedicated deployments.

Use a format with both r_xxx and h_xxx parameters only if the raster image and geoheader are in separate files.

This procedure does not support JPEG or GIF as a destination file format.

This procedure does not support GeoRaster objects that have a cellDepth value of 2BIT.

GeoRaster objects with a cell depth of 8 bits or greater that have a BSQ or BIL interleaving are exported in BIP interleaved format.

Before you call this procedure, you must have write permission on the output file or the directory to contain the files. The following example (run as user SYSTEM) grants write permission on a specified file to user HERMAN:

call dbms_java.grant_permission('HERMAN','SYS:java.io.FilePermission',
   '/mydirectory/myimages/img1.tif', 'write' );

The maximum amount of GeoRaster data that can be exported in a single operation is 67 megabytes (MB). Thus, the maximum dimensions of a GeoRaster object that can be exported at one time must be such that width*height*bands*cellDepth/8 <= 67 MB and rowBlockSize*columnBlockSize*bands*cellDepth/8 <= 67 MB. For example, for a 3-band, 8-bit GeoRaster object in which the width and height are equal:

  • The largest exportable width and height are 4728x4728.

  • The largest exportable block dimensions are 4096x4096.

Examples

The following example shows two export operations. The first operation exports an entire GeoRaster object (except for any georeferencing information) into a BMP format file. The second operation exports a subset of the GeoRaster object to a file with an ESRI world file.

DECLARE 
  geor SDO_GEORASTER;
  fileName VARCHAR2(1024);
  tfwName VARCHAR2(1024);
 
BEGIN
 
SELECT georaster INTO geor FROM georaster_table WHERE georid = 1;
 
-- Export the whole GeoRaster object into a BMP file, excluding any
-- georeferencing information.
sdo_geor.exportTo(geor, NULL, 'BMP', 'file',
  '/mydirectory/myimages/img1_export');
 
-- Export a subset to a file with a world file.
fileName := '/mydir/parrotExported';
tfwName := '/mydir/parrotWorldFile';
SELECT georaster INTO geor FROM georaster_table WHERE georid = 8;
sdo_geor.exportTo(geor, 'cropArea=(0,0,500,500)', 
  'TIFF', 'file', fileName, 'WORLDFILE', 'FILE', tfwName);
 
END;
/

The following example exports GeoRaster objects into BLOB and CLOB objects.

CREATE TABLE blob_table (blob_col BLOB, blobid NUMBER unique, clob_col CLOB);
INSERT INTO blob_table values (empty_blob(), 3, null);
INSERT INTO blob_table VALUES (empty_blob(), 4, empty_clob());
 
DECLARE
  lobd1 BLOB;
  lobd2 BLOB;
  lobd3 CLOB; 
  geor1 SDO_GEORASTER;
  geor2 SDO_GEORASTER;
 
BEGIN
 
-- Example 1: Export to BLOB.
SELECT blob_col INTO lobd1 FROM blob_table WHERE blobid=3 for update;
SELECT georaster INTO geor1 FROM georaster_table WHERE georid = 13;
sdo_geor.exportTo(geor1, '', 'TIFF', lobd1);
UPDATE blob_table set blob_col = lobd1 WHERE blobid=3;
COMMIT;
 
-- Example 2: Export GeoRaster to BLOB with world file exported to CLOB.
SELECT blob_col INTO lobd2 FROM blob_table WHERE blobid=4 for update;
SELECT clob_col INTO lobd3 FROM blob_table WHERE blobid=4 for update;
SELECT georaster INTO geor2 FROM georaster_table WHERE georid = 8;
sdo_geor.exportTo(geor2, 'cropArea=(0,0,500,500)', 'TIFF', lobd2,
  'WORLDFILE', lobd3);
UPDATE blob_table set blob_col = lobd2, clob_col = lobd3 WHERE blobid = 4;
COMMIT;
 
END;
/