MINI MINI MANI MO

Path : /proc/self/root/opt/oracle/product/18c/dbhomeXE/md/admin/
File Upload :
Current File : //proc/self/root/opt/oracle/product/18c/dbhomeXE/md/admin/sdograg.sql

Rem
Rem $Header: sdo/admin/sdograg.sql /main/21 2017/10/20 11:01:23 rjanders Exp $
Rem
Rem sdograg.sql
Rem
Rem Copyright (c) 2011, 2017, Oracle and/or its affiliates. 
Rem All rights reserved.
Rem
Rem    NAME
Rem      sdograg.sql - Package Header for SDO_GEOR_AGGR.
Rem
Rem    DESCRIPTION
Rem      <short description of component this file declares/defines>
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/sdograg.sql
Rem SQL_SHIPPED_FILE: md/admin/sdograg.sql
Rem SQL_PHASE: SDOGRAG
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/catmdsdop2.sql
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    rjanders    10/08/17 - Add MDSYS to spatial type
Rem    fechen      08/24/17 - add statistics calculation
Rem    fechen      03/02/16 - api update
Rem    zzhang      09/09/15 - add SQL file metadata
Rem    fechen      02/06/15 - add elevationParam
Rem    fechen      03/31/14 - enhance mosaicSubset 
Rem    rjanders    09/16/13 - OCCS: Remove hardtabs
Rem    rjanders    03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem                           initialization
Rem    fechen      10/18/12 - fix getMosaicResolutions
Rem    fechen      08/20/12 - change getMosaicResolution api
Rem    fechen      08/09/12 - change validateForMosaic api
Rem    fechen      10/24/11 - enable parallel for mosaicsubset
Rem    fechen      10/05/11 - remove alignTolerance
Rem    fechen      09/13/11 - add getmosaicresolutions
Rem    fechen      08/23/11 - add validateForMosaicSubset
Rem    fechen      07/15/11 - add append
Rem    fechen      06/10/11 - add more apis
Rem    fechen      04/11/11 - add tolerance
Rem    fechen      03/28/11 - add parameters
Rem    fechen      02/07/11 - Created
Rem

Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@@?/rdbms/admin/sqlsessstart.sql
Rem ********************************************************************

CREATE OR REPLACE PACKAGE MDSYS.SDO_GEOR_AGGR AUTHID CURRENT_USER AS

--
-- NAME:
--      mosaicSubset procedure
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         upper left corner of the cropArea, or when the 
--                         cropArea is null, the upper left corner of the 
--                         output extent.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored. It must be in format
--                         of "unit=val" where val is the unit name.  
--      mosaicParam      - The parameter related to mosaic
--      storageParam     - The storage parameter
--      outGeoRaster     - The output georaster object.
--      bgValues         - The background values for sparse data
--      parallelParam    - The parameter related to parallel processing. 
--                         Currently we only support 
--                           "parallel=DEFAULT": The database computes 
--                              the degree of parallelism, which can be 2 or 
--                              greater. 
--                           "parallel=n": where n>1 is the degree of parallel.
--                              The database optimizer uses the degree of 
--                              parallelism specified by n  
--                           By default when this parameter is null, there is
--                           no parallel processing.
--
-- RETURNS
--
  PROCEDURE mosaicSubset(
     inGeoRasters       IN SYS_REFCURSOR,
     pyramidLevel       IN NUMBER,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     storageParam       IN VARCHAR2,
     outGeoRaster       IN OUT MDSYS.SDO_GEORASTER,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     parallelParam      IN VARCHAR2 DEFAULT NULL
     );

--
-- NAME:
--      mosaicSubset procedure with elevationParam
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      elevationParam   - Average elevation height of the surface
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         upper left corner of the cropArea, or when the 
--                         cropArea is null, the upper left corner of the 
--                         output extent.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored. It must be in format
--                         of "unit=val" where val is the unit name.  
--      mosaicParam      - The parameter related to mosaic
--      storageParam     - The storage parameter
--      outGeoRaster     - The output georaster object.
--      bgValues         - The background values for sparse data
--      parallelParam    - The parameter related to parallel processing. 
--                         Currently we only support 
--                           "parallel=DEFAULT": The database computes 
--                              the degree of parallelism, which can be 2 or 
--                              greater. 
--                           "parallel=n": where n>1 is the degree of parallel.
--                              The database optimizer uses the degree of 
--                              parallelism specified by n  
--                           By default when this parameter is null, there is
--                           no parallel processing.
--      ReferenceImage:  - Defines the reference image used during the 
--                         color balance. If "cbreference" in the mosaic 
--                         parameter is "image" and the referenceImage parameter
--                         is null, the source image that is at the center
--                         of the mosaic is used as the reference image. 
--      ReferenceValue1: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      ReferenceValue2: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      refHistograms: - Defines the reference histogram used during the
--                            color balance of histogram matching
--
-- RETURNS
--
  PROCEDURE mosaicSubset(
     inGeoRasters       IN SYS_REFCURSOR,
     pyramidLevel       IN NUMBER,
     elevationParam     IN VARCHAR2,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     storageParam       IN VARCHAR2,
     outGeoRaster       IN OUT MDSYS.SDO_GEORASTER,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     parallelParam      IN VARCHAR2 DEFAULT NULL,
     referenceImage   IN  MDSYS.SDO_GEORASTER DEFAULT NULL, 
     referenceValue1 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceValue2 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     refHistograms IN MDSYS.SDO_GEOR_HISTOGRAM_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      mosaicSubset procedure
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         upper left corner of the cropArea, or when the 
--                         cropArea is null, the upper left corner of the 
--                         output extent.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      storageParam     - The storage parameter
--      outGeoRaster     - The output georaster object.
--      bgValues         - The background values for sparse data
--      parallelParam    - The parameter related to parallel processing. 
--                         Currently we only support 
--                           "parallel=DEFAULT": The database computes 
--                              the degree of parallelism, which can be 2 or 
--                              greater. 
--                           "parallel=n": where n>1 is the degree of parallel.
--                              The database optimizer uses the degree of 
--                              parallelism specified by n  
--                           By default when this parameter is null, there is
--                           no parallel processing.
--
-- RETURNS
--
  PROCEDURE mosaicSubset(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     pyramidLevel       IN NUMBER,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     storageParam       IN VARCHAR2,
     outGeoRaster       IN OUT MDSYS.SDO_GEORASTER,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL, 
     parallelParam      IN VARCHAR2 DEFAULT NULL
     );

--
-- NAME:
--      mosaicSubset procedure with elevationParam
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      elevationParam   - Average elevation height of the surface
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         upper left corner of the cropArea, or when the 
--                         cropArea is null, the upper left corner of the 
--                         output extent.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      storageParam     - The storage parameter
--      outGeoRaster     - The output georaster object.
--      bgValues         - The background values for sparse data
--      parallelParam    - The parameter related to parallel processing. 
--                         Currently we only support 
--                           "parallel=DEFAULT": The database computes 
--                              the degree of parallelism, which can be 2 or 
--                              greater. 
--                           "parallel=n": where n>1 is the degree of parallel.
--                              The database optimizer uses the degree of 
--                              parallelism specified by n  
--                           By default when this parameter is null, there is
--                           no parallel processing.
--      ReferenceImage:  - Defines the reference image used during the 
--                         color balance. If "cbreference" in the mosaic 
--                         parameter is "image" and the referenceImage parameter
--                         is null, the source image that is at the center
--                         of the mosaic is used as the reference image. 
--      ReferenceValue1: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      ReferenceValue2: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      refHistograms: - Defines the reference histogram used during the
--                            color balance of histogram matching
--
--
-- RETURNS
--
  PROCEDURE mosaicSubset(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     pyramidLevel       IN NUMBER,
     elevationParam     IN VARCHAR2,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     storageParam       IN VARCHAR2,
     outGeoRaster       IN OUT MDSYS.SDO_GEORASTER,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL, 
     parallelParam      IN VARCHAR2 DEFAULT NULL,
     referenceImage   IN  MDSYS.SDO_GEORASTER DEFAULT NULL, 
     referenceValue1 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceValue2 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     refHistograms IN MDSYS.SDO_GEOR_HISTOGRAM_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      getMosaicSubset procedure
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         left upper corner of the cropArea, or when the 
--                         cropArea is null, the upper corner of the outArea.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      rasterBlob       - The output Lob
--      outArea          - The output area in model space
--      outWindow        - The output window in cell space
--      storageParam     - The storage parameter
--      bgValues         - The background values for sparse data
--
-- RETURNS
--
  PROCEDURE getMosaicSubset(
     inGeoRasters       IN SYS_REFCURSOR,
     pyramidLevel       IN NUMBER,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     rasterBlob         IN OUT NOCOPY BLOB,
     outArea            OUT MDSYS.SDO_GEOMETRY,
     outWindow          OUT MDSYS.SDO_NUMBER_ARRAY,
     storageParam       IN VARCHAR2 DEFAULT NULL,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      getMosaicSubset procedure with elevationParam
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      elevationParam   - Average elevation height of the surface
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         left upper corner of the cropArea, or when the 
--                         cropArea is null, the upper corner of the outArea.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      rasterBlob       - The output Lob
--      outArea          - The output area in model space
--      outWindow        - The output window in cell space
--      storageParam     - The storage parameter
--      bgValues         - The background values for sparse data
--      ReferenceImage:  - Defines the reference image used during the 
--                         color balance. If "cbreference" in the mosaic 
--                         parameter is "image" and the referenceImage parameter
--                         is null, the source image that is at the center
--                         of the mosaic is used as the reference image. 
--      ReferenceValue1: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      ReferenceValue2: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      refHistograms: - Defines the reference histogram used during the
--                            color balance of histogram matching
--
--
-- RETURNS
--
  PROCEDURE getMosaicSubset(
     inGeoRasters       IN SYS_REFCURSOR,
     pyramidLevel       IN NUMBER,
     elevationParam     IN VARCHAR2,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     rasterBlob         IN OUT NOCOPY BLOB,
     outArea            OUT MDSYS.SDO_GEOMETRY,
     outWindow          OUT MDSYS.SDO_NUMBER_ARRAY,
     storageParam       IN VARCHAR2 DEFAULT NULL,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceImage   IN  MDSYS.SDO_GEORASTER DEFAULT NULL, 
     referenceValue1 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceValue2 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     refHistograms IN MDSYS.SDO_GEOR_HISTOGRAM_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      getMosaicSubset procedure
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         left upper corner of the cropArea, or when the 
--                         cropArea is null, the upper corner of the outArea.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      rasterBlob       - The output Lob
--      outArea          - The output area in model space
--      outWindow        - The output window in cell space
--      storageParam     - The storage parameter
--      bgValues         - The background values for sparse data
--
--
-- RETURNS
--
  PROCEDURE getMosaicSubset(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     pyramidLevel       IN NUMBER,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     rasterBlob         IN OUT NOCOPY BLOB,
     outArea            OUT MDSYS.SDO_GEOMETRY,
     outWindow          OUT MDSYS.SDO_NUMBER_ARRAY,
     storageParam       IN VARCHAR2 DEFAULT NULL,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      getMosaicSubset procedure with elevationParam
--
-- DESCRIPTION
--      Subset from a set of source georaster objects. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      pyramidLevel     - The pyramid level, if NULL and outResolution is
--                         specified, use the outResolution to determine the
--                         pyramidLevel, otherwise defaults to 0. 
--      elevationParam   - Average elevation height of the surface
--      outSRID          - The output georaster data's SRID.
--      outModelCoordLoc - The output georaster data's model coordinate 
--                         location. If NULL, defaults to CENTER. 
--      referencePoint   - The reference point of the mosaic. The mosaic result
--                         will align with this reference point. If this is 
--                         null, the reference point implicitly uses the 
--                         left upper corner of the cropArea, or when the 
--                         cropArea is null, the upper corner of the outArea.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point. 
--      cropArea         - The output georaster data's window. If the 
--                         sdo_geometry object has srid, the source georaster
--                         objects must be georeferenced, otherwise, the source
--                         georaster object can be georeferenced or non-
--                         georeferenced.  
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE. 
--      boundaryClip     - Whether to use the source data boundary to clip the 
--                         cropArea. If false, the outside the source
--                         data area is filled with background value. If NULL,
--                         defaults to TRUE. 
--      layerNumbers     - The layer numbers from the source georasters. If
--                         NULL, empty or has value of '0', all layers are 
--                         included. 
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      mosaicParam      - The parameter related to mosaic
--      rasterBlob       - The output Lob
--      outArea          - The output area in model space
--      outWindow        - The output window in cell space
--      storageParam     - The storage parameter
--      bgValues         - The background values for sparse data
--      ReferenceImage:  - Defines the reference image used during the 
--                         color balance. If "cbreference" in the mosaic 
--                         parameter is "image" and the referenceImage parameter
--                         is null, the source image that is at the center
--                         of the mosaic is used as the reference image. 
--      ReferenceValue1: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      ReferenceValue2: - Defines the reference value(s) used during the 
--                         color balance. The meaning of the value is 
--                         determined by the color balance method. 
--      refHistograms: - Defines the reference histogram used during the
--                            color balance of histogram matching
--
--
-- RETURNS
--
  PROCEDURE getMosaicSubset(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     pyramidLevel       IN NUMBER,
     elevationParam     IN VARCHAR2,
     outSRID            IN NUMBER, 
     outModelCoordLoc   IN NUMBER,
     referencePoint     IN MDSYS.SDO_GEOMETRY,
     cropArea           IN MDSYS.SDO_GEOMETRY,
     polygonClip        IN VARCHAR2, 
     boundaryClip       IN VARCHAR2,
     layerNumbers       IN VARCHAR2,
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     mosaicParam        IN VARCHAR2,
     rasterBlob         IN OUT NOCOPY BLOB,
     outArea            OUT MDSYS.SDO_GEOMETRY,
     outWindow          OUT MDSYS.SDO_NUMBER_ARRAY,
     storageParam       IN VARCHAR2 DEFAULT NULL,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceImage   IN  MDSYS.SDO_GEORASTER DEFAULT NULL, 
     referenceValue1 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     referenceValue2 IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
     refHistograms IN MDSYS.SDO_GEOR_HISTOGRAM_ARRAY DEFAULT NULL
     );

--
-- NAME:
--      validateForMosaicSubset procedure
--
-- DESCRIPTION
--      Check if the mosaic request is valid. The validation result is stored
--  in a user created result table with the following columns:  
--   (time timestamp, type varchar2, description varchar2, 
--    table_name varchar2, column_name varchar2, rdt_table_name varchar2, 
--    raster_id number)
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      outSRID          - The output georaster data's SRID.
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      resultTableName  - The name of the result table. 
--
-- RETURNS
--
  PROCEDURE validateForMosaicSubset(
     inGeoRasters       IN SYS_REFCURSOR,
     outSRID            IN NUMBER, 
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     resultTableName    IN VARCHAR2
     );

--
-- NAME:
--      validateForMosaicSubset procedure
--
-- DESCRIPTION
--      Check if the mosaic request is valid. The validation result is stored
--  in a user created result table with the following columns:  
--   (time timestamp, type varchar2, description varchar2, 
--    table_name varchar2, column_name varchar2, rdt_table_name varchar2, 
--    raster_id number)
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      outSRID          - The output georaster data's SRID.
--      outResolutions   - Output georaster data's resolution. If NULL, defaults
--                         to the source data's resolution at the given 
--                         pyramid level.  
--      resolutionUnit   - The unit of the output resolution. If NULL, defaults
--                         to the unit of the output SRID. If outResolutions is
--                         NULL, this parameter is ignored.It must be in format
--                         of "unit=val" where val is the unit name.   
--      resultTableName  - The name of the result table. 
--
-- RETURNS
--
  PROCEDURE validateForMosaicSubset(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     outSRID            IN NUMBER, 
     outResolutions     IN MDSYS.SDO_NUMBER_ARRAY, 
     resolutionUnit     IN VARCHAR2,
     resultTableName    IN VARCHAR2
     );

--
-- NAME:
--      getMosaicExtent Function.
--
-- DESCRIPTION
--  Calculate the extent of the total mosaic set. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      outSRID          - The SRID of the output extent. If null, the
--                         SRID of the output extent will use 4326 (WGS84)
--
-- RETURNS: A MDSYS.GEOMETRY object that describes the MBR of the total mosaic.
--
FUNCTION getMosaicExtent(
     inGeoRasters       IN SYS_REFCURSOR,
     outSRID            IN NUMBER  DEFAULT NULL
) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;

--
-- NAME:
--      getMosaicExtent Function.
--
-- DESCRIPTION
--  Calculate the extent of the total mosaic set. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      outSRID          - The SRID of the output extent. If null, the
--                         SRID of the output extent will use 4326 (WGS84)
--
-- RETURNS: A MDSYS.GEOMETRY object that describes the MBR of the total mosaic.
--
FUNCTION getMosaicExtent(
     georasterTableNames IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     outSRID            IN NUMBER  DEFAULT NULL
) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC;

--
-- NAME:
--      getMosaicResolutions Function.
--
-- DESCRIPTION
--  Get the resolution range of the total mosaic set in a given coordinate
--  system. 
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      resolutionUnit   - The unit of the output resolution range. If NULL, 
--                         defaults to 'unit=METER'. It must be in format
--                         of "unit=val" where val is the unit name.  
-- RETURN:               - The output x and y resolution range in 
--                         MDSYS.SDO_RANGE_ARRAY. The resolution unit will
--                         be the unit defined by the targetSRID. 
--
--
FUNCTION  getMosaicResolutions(
     inGeoRasters       IN SYS_REFCURSOR,
     resolutionUnit     IN VARCHAR2 DEFAULT NULL 
) return MDSYS.SDO_RANGE_ARRAY DETERMINISTIC;

--
-- NAME:
--      getMosaicResolutions Function.
--
-- DESCRIPTION
--  Get the resolution range of the total mosaic set in a given coordinate
--  system. 
--      
-- ARGUMENTS
--      georasterTableNames - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      resolutionUnit   - The unit of the output resolution range. If NULL, 
--                         defaults to 'unit=METER'. It must be in format
--                         of "unit=val" where val is the unit name.  
--      targetSRID       - The target SRID for the resolution. If null, the
--                         target SRID will default to 4326 (WGS84)
-- RETURN:               - The output x and y resolution range in 
--                         MDSYS.SDO_RANGE_ARRAY. The resolution unit will
--                         be the unit defined by the targetSRID. 
--
FUNCTION getMosaicResolutions(
     georasterTableNames  IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     resolutionUnit       IN VARCHAR2 DEFAULT NULL 
) RETURN MDSYS.SDO_RANGE_ARRAY DETERMINISTIC;

--
-- NAME:
--      getMosaicStatistics Function.
--
-- DESCRIPTION
--  Get the estimated statistics of the total mosaic set for each band. 
--  This requires that the statistics of the source images in the metadata. 
--  When genHistogram parameter is 'false', only min, max, mean and std for 
--  each band are returned in the outStatistics parameter. Null is returned in 
--  the outHistogram parameter.
--  When genHistogram parameter is 'true', min, max, mean, std, median, mode 
--  for each band are returned accordingly in the outStatistics parameter. 
--  Histograms for each band are returned in the outHistograms parameter. 
--      
--      
-- ARGUMENTS
--      inGeoRasters     - The input source georaster objects in a cursor. 
--      skipFactor       - The number of images to be skipped during the 
--                         calculation. 
--      genHistogram     - Whether to return the estimated histogram.
--      outStatistics    - The statistics for each band of the mosaic
--      outHistograms    - The histograms of each band in an array
--
--
PROCEDURE  getMosaicStatistics(
     inGeoRasters       IN SYS_REFCURSOR,
     skipFactor         IN NUMBER default 1,
     genHistogram       IN VARCHAR2 default 'FALSE',
     outStatistics      OUT MDSYS.SDO_NUMBER_ARRAYSET,
     outHistograms      OUT MDSYS.SDO_GEOR_HISTOGRAM_ARRAY 
);

--
-- NAME:
--      getMosaicStatistics Function.
--
-- DESCRIPTION
--  Get the estimated statistics the total mosaic set. This requires that 
--  the statistics of the source images in the metadata. 
--  When genHistogram parameter is 'false', only min, max, mean and std for 
--  each band are returned in the outStatistics parameter. Null is returned in 
--  the outHistogram parameter.
--  When genHistogram parameter is 'true', min, max, mean, std, median, mode 
--  for each band are returned accordingly in the outStatistics parameter. 
--  Histograms for each band are returned in the outHistograms parameter. 
--      
-- ARGUMENTS
--      georasterTableNames  - The table names of the input georaster objects
--      georasterColumnNames - The column names of the input georaster objects 
--      skipFactor           - The number of images to be skipped during the 
--                             calculation. 
--      genHistogram         - Whether to return the estimated histogram.
--      outStatistics        - The statistics for each band of the mosaic
--      outHistograms        - The histograms of each band in an array
--
PROCEDURE getMosaicStatistics(
     georasterTableNames  IN VARCHAR2,
     georasterColumnNames IN VARCHAR2,
     skipFactor           IN NUMBER default 1,
     genHistogram         IN VARCHAR2 default 'FALSE',
     outStatistics        OUT MDSYS.SDO_NUMBER_ARRAYSET,
     outHistograms        OUT MDSYS.SDO_GEOR_HISTOGRAM_ARRAY 
);

--
-- NAME:
--      Append procedure
--
-- DESCRIPTION
--      Append one GeoRaster object to another GeoRaster object. 
--
-- The source and target GeoRaster objects must have the same number of bands. 
--
-- There is no change on metadata of target GeoRaster object except the 
-- extent, the number of blocks and statistics removed. 
--      
-- The mask of the target GeoRaster object is expanded according to the 
-- raster data expansion. 
--
-- The sourceGeoRaster object will be appended to the targetGeoRaster pyramid
-- level 0. The pyramids of the target GeoRaster object are updated too. 
--
-- The overlapping area of the source and targe GeoRaster objects are resolved 
-- according to the commonPointRule defined in the appendParam. 
--
-- ARGUMENTS
--      targetGeoRaster - The GeoRaster object to be appended. Cannot be the
--                        same GeoRaster. (Be sure to make a copy of this 
--                        object before calling this procedure as this object
--                        will be modified).  
--      sourceGeoRaster - The GeoRaster object to be appended to targeGeoRaster 
--      sourcePyramidLevel - The source GeoRaster object pyramid level to be 
--                         appended at the target GeoRaster object pyramid level
--                         0. If NULL, pyramid level 0 is used.  
--      appendParam      - The parameter related to append. 
--      bgValues         - The background values for sparse data
--
--
  PROCEDURE Append(
     targetGeoRaster    IN OUT NOCOPY MDSYS.SDO_GEORASTER,
     sourceGeoRaster    IN MDSYS.SDO_GEORASTER,
     sourcePyramidLevel IN NUMBEr,
     appendParam        IN VARCHAR2,
     bgValues           IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
     );

END SDO_GEOR_AGGR;
/
show errors;


Rem ********************************************************************
Rem #16473696: Indicate Oracle-Supplied object
@?/rdbms/admin/sqlsessend.sql
Rem ********************************************************************


OHA YOOOO