12.8 SDO_GEOR_RA.stack

Format (SDO_GEORASTER_ARRAY input)

SDO_GEOR_RA.stack(
     georArray     IN SDO_GEORASTER_ARRAY, 
     cropArea      IN SDO_NUMBER_ARRAY, 
     layerList     IN SDO_NUMBER_ARRAY, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     outGeoRaster  IN OUT SDO_GEORASTER, 
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER DEFAULT 0, 
     parallelParam IN VARCHAR2 DEFAULT NULL);
SDO_GEOR_RA.stack(
     georArray     IN SDO_GEORASTER_ARRAY, 
     cropArea      IN SDO_GEOMETRY, 
     layerList     IN SDO_NUMBER_ARRAY, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     outGeoRaster  IN OUT SDO_GEORASTER, 
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER DEFAULT 0, 
     polygonClip   IN VARCHAR2 DEFAULT 'FALSE', 
     parallelParam IN VARCHAR2 DEFAULT NULL);

or

DO_GEOR_RA.stack(
     georArray    IN SDO_GEORASTER_ARRAY,
     cropArea     IN SDO_NUMBER_ARRAY,
     layerList    IN SDO_NUMBER_ARRAY,
     method       IN VARCHAR2,
     storageParam IN VARCHAR2 DEFAULT NULL,
     rasterBlob   IN OUT NOCOPY BLOB,
     outArea      OUT SDO_GEOMETRY,
     outWindow    OUT SDO_NUMBER_ARRAY,
     nodata       IN VARCHAR2 DEFAULT ‘FALSE’,
     nodataValue  IN NUMBER default 0,;
SDO_GEOR_RA.stack(
     georArray    IN SDO_GEORASTER_ARRAY,
     cropArea     IN SDO_GEOMETRY,
     layerList    IN SDO_NUMBER_ARRAY,
     method       IN VARCHAR2,
     storageParam IN VARCHAR2 DEFAULT NULL,
     rasterBlob   IN OUT NOCOPY BLOB,
     outArea      OUT SDO_GEOMETRY,
     outWindow    OUT SDO_NUMBER_ARRAY,
     nodata       IN VARCHAR2 DEFAULT ‘FALSE’,
     nodataValue  IN NUMBER default 0,
     polygonClip  IN VARCHAR2 DEFAULT ‘FALSE’);

Format (SYS_REFCURSOR input)

SDO_GEOR_RA.stack(
     inGeoRasters  IN SYS_REFCURSOR, 
     cropArea      IN SDO_NUMBER_ARRAY, 
     bandNumber    IN NUMBER, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     outGeoRaster  IN OUT SDO_GEORASTER, 
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER DEFAULT 0, 
     parallelParam IN VARCHAR2 DEFAULT NULL);
SDO_GEOR_RA.stack(
     inGeoRasters  IN SYS_REFCURSOR, 
     cropArea      IN SDO_GEOMETRY, 
     bandNumber    IN NUMBER, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     outGeoRaster  IN OUT SDO_GEORASTER, 
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER DEFAULT 0, 
     polygonClip   IN VARCHAR2 DEFAULT 'FALSE', 
     parallelParam IN VARCHAR2 DEFAULT NULL);

or

DO_GEOR_RA.stack(
     inGeoRasters  IN SYS_REFCURSOR, 
     cropArea      IN SDO_NUMBER_ARRAY, 
     bandNumber    IN NUMBER, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     rasterBlob    IN OUT NOCOPY BLOB,
     outArea       OUT SDO_GEOMETRY,
     outWindow     OUT SDO_NUMBER_ARRAY,
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER default 0,;
SDO_GEOR_RA.stack(
     inGeoRasters  IN SYS_REFCURSOR, 
     cropArea      IN SDO_GEOMETRY, 
     bandNumber    IN NUMBER, 
     method        IN VARCHAR2, 
     storageParam  IN VARCHAR2 DEFAULT NULL, 
     rasterBlob    IN OUT NOCOPY BLOB,
     outArea       OUT SDO_GEOMETRY,
     outWindow     OUT SDO_NUMBER_ARRAY,
     nodata        IN VARCHAR2 DEFAULT 'FALSE', 
     nodataValue   IN NUMBER DEFAULT 0, 
     polygonClip   IN VARCHAR2 DEFAULT ‘FALSE’);

Description

Generates a single-layer raster either in a GeoRaster object or a single BLOB whose cell values are a local statistics value of a list of layers or bands of the input GeoRaster objects. The input layers are specified by the layerList parameter (or input bands by the bandNumber parameter), and the statistics method is specified by the method parameter.

Parameters

georArray

An array of GeoRaster objects. The data type is SDO_GEOR_ARRAY, which is defined as VARRAY(10485760) OF SDO_GEORASTER.

inGeoRasters

Cursor (SYS_REFCURSOR type) for the input GeoRaster objects.

cropArea

Crop area definition. If the SDO_GEOMETRY object has a non-null SRID, the source GeoRaster objects must be georeferenced; otherwise, the source GeoRaster objects can be georeferenced or non-georeferenced. If polygonClip is FALSE, the MBR of the cropArea is used to crop the data. If polygonClip is TRUE, the geometry of the cropArea is used to crop the data.

If the data type is SDO_NUMBER_ARRAY, the parameter identifies the upper-left (row, column) and lower-right (row, column) coordinates of a rectangular window, and raster space is assumed.

layerList

A number array to specify which bands of the input GeoRaster objects are used to compute statistics value for output. For example, if georArray specifies three GeoRaster objects geor1,geor2,geor3, which have 2,3,4 bands respectively, a layer list {0,3,7} is used to specify three bands as follows:

  • The first band of the first GeoRaster object geor1

  • The second band of the second GeoRaster object geor2

  • The third band of the third GeoRaster object geor3

bandNumber

If null, then all bands of the input GeoRaster objects are involved in the statistics calculation; otherwise, the specified band of the input GeoRaster objects is involved in the statistics calculation. For example, if bandNumber is 0 (zero), then all of the first band of the input GeoRaster objects are involved in the statistics calculation.

method

A string to specify what local statistics value should be returned. It should be one of the following values: max, min, median, mean, std, sum, minority, majority, diversity.

storageParam

A string specifying storage parameters, as explained in Storage Parameters.

outGeoRaster

Output GeoRaster object.

rasterBlob

BLOB to hold the output of the processing result. It must exist or have been initialized before the operation.

outArea

An SDO_GEOMETRY object containing the MBR (minimum bounding rectangle) in the model coordinate system of the resulting object.

outWindow

An SDO_NUMBER_ARRAY object identifying the coordinates of the upper-left and lower-right corners of the output window in the cell space.

nodata

The string TRUE specifies that if there are any NODATA cells in the specified layerList parameter, the corresponding cells in the output GeoRaster object are to be set to the value specified for the nodataValue parameter. The string FALSE (the default) causes cells with NODATA values to be considered as regular data. NODATA values and value ranges are discussed in NODATA Values and Value Ranges.

nodataValue

The value used to set NODATA cells if the nodata parameter value is the string TRUE.

parallelParam

Specifies the degree of parallelism for the operation. If specified, must be in the form parallel=n, where n is greater than 1. The database optimizer uses the degree of parallelism specified by this parameter. If not specified, then by default there is no parallel processing. (For more information, see Parallel Processing in GeoRaster.)

Specifying parallelParam means that you cannot roll back the results of this procedure, as explained in the Usage Notes.

Usage Notes

All of the input GeoRaster objects must have same dimension size; otherwise, the ORA-13397 error is generated.

If you specify parallelParam, some execution units of the procedure run as autonomous transactions, which means that some changes are committed while the procedure is running and therefore you cannot roll back those changes. If you do not specify this parameter, you can roll back all changes.

Examples

The following example performs the stack operation on two input GeoRaster objects. The output is a GeoRaster object.

DECLARE
  geor       SDO_GEORASTER;
  geor1      SDO_GEORASTER;
  geor2      SDO_GEORASTER;
  geom       mdsys.sdo_geometry;
BEGIN
  geom:= sdo_geometry(2003,82394, NULL,
               sdo_elem_info_array(1, 1003, 1),
               sdo_ordinate_array(20283.775, 1011087.9,
                                  18783.775, 1008687.9,
                                  21783.775, 1008687.9,
                                  22683.775+0.001, 1009587.9+0.001,
                                  20283.775, 1011087.9));
  select georaster into geor from georaster_table where georid = 100;
  select georaster into geor2 from georaster_table where georid = 102;
  select georaster into geor1 from georaster_table where georid = 101 for update;
  sdo_geor_ra.stack(SDO_GEORASTER_ARRAY(geor,geor2),geom,SDO_NUMBER_ARRAY(3,5),'max',null,geor1,'false',0,'TRUE');
  update georaster_table set georaster = geor1 where georid = 101;
END;
/

The following example performs the stack operation on two input GeoRaster objects. The output is a BLOB.

DECLARE
  geor       SDO_GEORASTER;
  geor2      SDO_GEORASTER;
  geom       sdo_geometry;
  out_lob    BLOB;
  outArea    sdo_geometry;
  outWindow  sdo_number_array;
BEGIN
  geom:= null;
  select georaster into geor from georaster_table where georid = 100;
  select georaster into geor2 from georaster_table where georid = 102;
  dbms_lob.create_temporary(out_lob, TRUE);
  sdo_geor_ra.stack(SDO_GEORASTER_ARRAY(geor,geor2),geom,SDO_NUMBER_ARRAY(3,5),'max',null,out_lob, outArea, outWindow);
  if outWindow is not null then
     dbms_output.put_line('output window: (' || outWindow(1) || ',' ||
                           outWindow(2) || ',' || outWindow(3) || ',' || outWindow(4) || ')');
  end if;
  dbms_lob.freeTemporary(out_lob);
END;
/

The following example performs the stack operation on the first band of the two input GeoRaster objects in a cursor. The output is a GeoRaster object.

DECLARE
  geor1      SDO_GEORASTER;
  mycur      SYS_REFCURSOR;
  geom       mdsys.sdo_geometry;
BEGIN
  geom:= sdo_geometry(2003,82394, NULL,
               sdo_elem_info_array(1, 1003, 1),
               sdo_ordinate_array(20283.775, 1011087.9,
                                  18783.775, 1008687.9,
                                  21783.775, 1008687.9,
                                  22683.775+0.001, 1009587.9+0.001,
                                  20283.775, 1011087.9));
  open mycur for 'select georaster from georaster_table where georid in (100, 102)';
  select georaster into geor1 from georaster_table where georid = 101 for update;
  sdo_geor_ra.stack(mycur,geom,0,'max',null,geor1,'false',0,'TRUE');
  update georaster_table set georaster = geor1 where georid = 101;
END;
/