MINI MINI MANI MO

Path : /opt/oracle/product/18c/dbhomeXE/md/admin/
File Upload :
Current File : //opt/oracle/product/18c/dbhomeXE/md/admin/sdogr.sql

Rem Copyright (c) 2001, 2017, Oracle and/or its affiliates. 
Rem All rights reserved.
Rem
Rem    NAME
Rem      sdogr.sql - GeoRaster SDO_GEOR package header
Rem
Rem    DESCRIPTION
Rem      Major PLSQL API of Oracle GeoRaster
Rem
Rem    NOTES
Rem      <other useful comments, qualifications, etc.>
Rem
Rem BEGIN SQL_FILE_METADATA
Rem SQL_SOURCE_FILE: sdo/admin/sdogr.sql
Rem SQL_SHIPPED_FILE: md/admin/sdogr.sql
Rem SQL_PHASE: SDOGR
Rem SQL_STARTUP_MODE: NORMAL
Rem SQL_IGNORABLE_ERRORS: NONE
Rem SQL_CALLING_FILE: sdo/admin/catmdsdoh.sql
Rem END SQL_FILE_METADATA
Rem
Rem    MODIFIED   (MM/DD/YY)
Rem    rjanders    10/08/17 - Add MDSYS to spatial type
Rem    fechen      05/19/17 - polygon clipping for decompressjp2
Rem    rjanders    05/10/17 - #26037683: Raise 'when other' exceptions
Rem    rjanders    03/23/17 - #25437999: Remove 'when others then NULL'
Rem                           handlers
Rem    ilucena     09/07/16 - add generateMask to rectify
Rem    zzhang      08/25/16 - add a new interface for getRasterSubset
Rem    zzhang      07/18/16 - fix bug 24312449
Rem    zzhang      05/26/16 - Move memory API from sdo_geor to sdo_geor_utl
Rem    ilucena     04/19/16 - Add function affineTransform
Rem    zzhang      02/17/16 - Change function names
Rem    zzhang      11/19/15 - move generateBitmapPyramid to sdo_geor
Rem    ilucena     10/20/15 - move generate ramp to utl
Rem    czechar     08/14/15 - adding SQL file metadata
Rem    fechen      04/01/15 - add getJP2TileSize
Rem    zzhang      03/28/15 - enhance getRasterSubset to return 
Rem                           data in a sdo_number_array
Rem    ilucena     03/16/15 - add generateGrayRamp
Rem    ilucena     03/09/15 - add warp
Rem    ilucena     03/09/15 - add generateColorRamp
Rem    fechen      02/06/15 - add jp2 compress/decompress
Rem    zzhang      12/11/14 - add multipoint support in getCellValues and 
Rem                           evaluateDoubles/getBitmapMaskValues/changeCellValues
Rem    fechen      11/17/14 - add deletePyramid with plevel
Rem    zzhang      07/22/14 - parallel statistics
Rem    ilucena     07/01/14 - Rectify parallel
Rem    zzhang      03/18/14 - add memory control by user
Rem    rjanders    09/16/13 - OCCS: Remove hardtabs
Rem    zzhang      07/25/13 - Add function
Rem                           generateAreaWeightedMean
Rem    rjanders    03/15/13 - #16473696: Start/End _ORACLE_SCRIPT
Rem                           initialization
Rem    fechen      08/29/12 - support parallel for pyramid
Rem    ilucena     07/10/12 - elevationParam on Rectify
Rem    fechen      06/12/12 - add setNODATAMask
Rem    zzhang      03/12/12 - statistics on the fly
Rem    fechen      12/16/11 - add setSpatialResolution to GCP georeference
Rem    fechen      11/21/11 - add generateSpatialResolutions
Rem    fechen      11/11/11 - remove old mosaic
Rem    zzhang      10/25/11 - implements new statistics function
Rem    zzhang      09/07/11 - rewrite statistics APIs
Rem    zzhang      06/07/11 - Add getRasterRange
Rem    ilucena     06/01/11 - add referencePoint to Rectify
Rem    rjanders    02/24/11 - Make sdo_geometry functions DETERMINISTIC
Rem    ilucena     02/03/11 - Add function Rectify
Rem    fechen      01/21/11 - add pyramidlevel to mergelayers
Rem    fechen      11/10/10 - add new api for mosaic
Rem    zzhang      05/20/10 - map algebra 
Rem    fechen      05/07/10 - add default alpha and pyramid level
Rem    hzhu        03/18/09 - Add polygon clipping to subset()
Rem    hzhu        02/06/09 - Remove the reproject interfaces without
Rem                           pyramidLevel
Rem    hzhu        01/14/09 - Remove rasterizePolygon() PUBLIC interfaces
Rem    hzhu        01/06/09 - Add polygon subsetting option to getRasterSubset()
Rem    hzhu        10/20/08 - Add setModelCoordLocation
Rem    hzhu        09/18/08 - Add rasterizepolygon
Rem    wexu        07/25/08 - add new mosaic interface
Rem    wexu        07/23/08 - bug 7197832 - revoke exec priv during upgrade
Rem    hzhu        07/15/08 - Add getGCPGeorefMethod, setGCPGeorefMethod
Rem                               getControlPoint, setControlPoint,
Rem                               deleteControlPoint
Rem    hzhu        06/27/08 - Add setGCPGeorefModel
Rem    hzhu        06/09/08 - Add getGCPGeorefModel
Rem    hzhu        04/04/08 - Add PyramidLevel to reprojection
Rem    hzhu        03/14/08 - Add georeferencing functions
Rem    hzhu        08/06/07 - Add reproject functions
Rem    wexu        05/10/07 - bug 6044929
Rem    wexu        04/18/07 - add getCellCoordinate
Rem    wexu        03/21/07 - bug 5946739
Rem    wexu        03/01/07 - add pyramidLevel to
Rem                           changeFormatCopy/scaleCopy/subset
Rem    zzhang      03/08/07 - bug 5918656 
Rem    wexu        02/26/07 - add getModelCoordLocation
Rem    zzhang      02/19/07 - enhance generateStatistics
Rem    wexu        02/13/07 - updateRaster enhanced
Rem    wexu        01/10/07 - setBitmapMask interface changed
Rem    wexu        12/14/06 - createTemplate interface updated
Rem    wexu        11/16/06 - add outWindow parameter to getBitmapMaskSubset
Rem    zzhang      11/07/06 - change parameter name
Rem    wexu        11/03/06 - add height/vert_id/ellipsoidal to
Rem                           getCellCoordinate
Rem    wexu        09/07/06 - updateRaster
Rem    wexu        09/19/06 - getCellCoordinate interface changed
Rem    zzhang      09/26/06 - remove API analyzeStatistics
Rem    zzhang      06/19/06 - add statistics functions
Rem    wexu        08/31/06 - remove setHistogram
Rem    wexu        08/24/06 - add samplingFactor/samplingWindow parameter
Rem    wexu        06/28/06 - add new getRasterSubset interface 
Rem    wexu        06/16/06 - make createTemplate DETERMINISTIC 
Rem    wexu        06/03/06 - add createTemplate etc 
Rem    syuditsk    05/30/06 - add isLossless fn 
Rem    wexu        05/03/06 - add mergeLayers
Rem    zzhang      04/11/06 - add a new function getGeoreferenceType
Rem    wexu        03/10/06 - bitmap mask related interfaces changed 
Rem    wexu        02/21/06 - support bitmap masks 
Rem    wexu        01/16/06 - add bgValues to mosaic etc.
Rem    wexu        01/04/06 - multiple nodata 
Rem    wexu        12/23/05 - add setHistogram etc 
Rem    wexu        05/21/04 - add compress parameter in getRasterSubset 
Rem    qxie        01/27/04 - add calcCompressionRatio
Rem    qxie        07/22/03 - comments
Rem    syuditsk    06/22/03 - new signatures - import, export
Rem    syuditsk    06/18/03 - changing signatures for importFrom, exportTo
Rem    qxie        05/30/03 - subsetParam in exportTo
Rem    qxie        05/23/03 - add func georeference
Rem    qxie        04/29/03 - typo fix for importFrom and exportTo
Rem    wexu        04/16/03 - mosaic
Rem    qxie        04/16/03 - add changeCellValue
Rem    qxie        04/15/03 - add importFrom and exportTo BLOBs
Rem    qxie        04/14/03 - exportTo() georaster IN only
Rem    wexu        04/08/03 - add setVersion etc
Rem    wexu        03/18/03 - getRaster interface changed
Rem    wexu        02/27/03 - add new getRaster{Blocks|Subset} interfaces
Rem    syuditsk    01/16/03 - 
Rem    syuditsk    01/13/03 - adding missing storageParams argument to exportTo
Rem    qxie        11/15/02 - move trig funcs to sdo_geor_utl
Rem    wexu        10/29/02 - getVersion interface changed
Rem    qxie        10/16/02 - name consistency
Rem    qxie        10/14/02 - rename scaling params
Rem    qxie        10/08/02 - add more GETs and all SETs and others
Rem    wexu        10/08/02 - getCellValue interface change
Rem    wexu        10/08/02 - add deletePyramid
Rem    wexu        10/04/02 - remove SDO_GEOR_METADATA parameters
Rem    qxie        09/30/02 - add schemaValidate
Rem    wexu        09/27/02 - add generatePyramid etc.
Rem    qxie        09/06/02 - add importFrom
Rem    wexu        09/05/02 - add scale and scaleCopy
Rem    wexu        07/26/02 - add getCellValue, etc.
Rem    wexu        07/26/02 - add subset
Rem    wexu        07/22/02 - add changeFormatCopy
Rem    qxie        04/09/02 - add validate
Rem    qxie        04/03/02 - change pragmas
Rem    qxie        03/26/02 - updated
Rem    qxie        12/21/01 - GeoRaster DML trigger procedures
Rem    qxie        12/13/01 - init and create functions
Rem    qxie        12/13/01 - Created
Rem

Rem ********************************************************************
Rem This package must not be modified by the customer.  Doing so
Rem could cause internal errors.
Rem ********************************************************************

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

-- bug 7197832: revoke public execute privilege with grant option
-- this is necessary for upgrade cases
DECLARE
  already_revoked exception;
  pragma exception_init(already_revoked, -01927);
  package_not_found exception;
  pragma exception_init(package_not_found, -04042);
BEGIN
  BEGIN
    EXECUTE IMMEDIATE 'REVOKE EXECUTE ON MDSYS.SDO_GEOR FROM PUBLIC';
    EXCEPTION
      when already_revoked then NULL;
      when package_not_found then NULL;
      WHEN OTHERS THEN
        SYS.DBMS_SYSTEM.KSDWRT(SYS.DBMS_SYSTEM.TRACE_FILE,
                               'EXCEPTION[sdogr.sql(' || $$PLSQL_LINE || ')1]: ' || SQLERRM); RAISE;
  END;
END;
/

CREATE OR REPLACE PACKAGE MDSYS.SDO_GEOR AUTHID CURRENT_USER AS


-- ---------------------------------------------------------------------
--           Create and Process GeoRaster Objects
-- ---------------------------------------------------------------------

--
-- NAME:
--      init constructor functions
--
-- DESCRIPTION
--      init()s return a GeoRaster Object which is empty except that a RDT 
--      table name and a raster ID are assigned to it. The RDT and ID are
--      required so that this object can be registered in the sysdata table
--      All other attributes are NULL. 
--
--      If rasterDataTable or rasterID is not specified, it is generated
--      automatically.
--
-- ARGUMENTS
--      rasterDataTable - RDT table name
--      rasterID        - rasterID number
--
-- RETURNS
--      An GeoRaster object with rasterDataTable and rasterID initialized
--

FUNCTION init
(
   rasterDataTable IN VARCHAR2 DEFAULT NULL,
   rasterID        IN NUMBER DEFAULT NULL
)
RETURN MDSYS.SDO_GEORASTER DETERMINISTIC;


--
-- NAME:
--      createBlank functions
--
-- DESCRIPTION
--      create a blank GeoRaster object which has normal size as
--      any other GeoRaster objects except that all its cells
--      have the same value, such as 100, 5, 54.6.
--
--      NOTE, the spatialExtent will always have NULL srid and
--      integer coordinates until it is georeferenced to another CS.
--      Initially, the blank object is not georeferenced.
--
-- ARGUMENTS
--      rasterType - the GeoRaster Type defined by Oracle.
--                   the number of dimensions is implied in it
--      ultCoord   - Upper-Left corner cell coordinate (integer) in 
--                   cell space. The default is (0,0)
--      dimSizes   - the size (cell numbers) along each dimension
--      cellValue  - the cell value for all raster cells
--
--      rasterDataTable and rasterID have the similar implications
--      as in init() functions. See init() comments
--
-- RETURNS
--      A Blank GeoRaster object
--

FUNCTION createBlank
(
   rasterType      IN INTEGER,
   ultCoord        IN MDSYS.SDO_NUMBER_ARRAY,
   dimSizes        IN MDSYS.SDO_NUMBER_ARRAY,
   cellValue       IN NUMBER,
   rasterDataTable IN VARCHAR2 DEFAULT NULL,
   rasterID        IN NUMBER DEFAULT NULL
)
return MDSYS.SDO_GEORASTER DETERMINISTIC;


--
-- NAME:
--      copy procedure
--
-- DESCRIPTION
--      Makes a simple copy of an existing GeoRaster object.
--      
-- ARGUMENTS
--      inGeoRaster    - The SDO_GEORASTER object to be copied
--      outGeoRaster   - The new GeoRaster Object
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE copy
(
   inGeoRaster    IN     MDSYS.SDO_GEORASTER,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER 
);

--
-- NAME:
--      changeFormat procedure
--
-- DESCRIPTION
--      Change the storage format of an existing GeoRaster object.
--
-- ARGUMENTS
--      georaster    - The SDO_GEORASTER object whose format to be changed
--      storageParam - A string specifying storage parameters 
--                     The details are explained in GeoRaster Manual
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE changeFormat
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   storageParam IN VARCHAR2,
   bgValues     IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);
   
--
-- NAME:
--      changeFormatCopy procedure
--
-- DESCRIPTION
--      Makes a copy of an existing GeoRaster object with the same or 
--      different storage format.
--      
-- ARGUMENTS
--      inGeoRaster    - The SDO_GEORASTER object to be copied
--      pyramidLevel   - The pyramid level of the source GeoRaster object
--      storageParam   - A string specifying storage parameters for the copy
--                       The details are explained in GeoRaster Manual
--      outGeoRaster   - The new GeoRaster Object
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE changeFormatCopy
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE changeFormatCopy
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel   IN NUMBER,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      maks procedure
--
-- DESCRIPTION
--      apply a mask to  an existing GeoRaster object with the same or 
--      different storage format.
--      
-- ARGUMENTS
--      inGeoRaster    - The SDO_GEORASTER object to be applied with mask
--      bandNumbers    - The physical bands in cell space
--      mask           - The mask SDO_GEORASTER object
--      storageParam   - A string specifying storage parameters for the copy
--                       The details are explained in GeoRaster Manual
--      outGeoRaster   - The new GeoRaster Object
--      zeroMapping    - The value is used for mask value 0
--      onemapping     - The value is used for mask value 1  
--      bgValues       - background values for filling sparse data
--
--
PROCEDURE mask
(
   inGeoraster  IN      MDSYS.SDO_GEORASTER,
   bandNumbers  IN      VARCHAR2,
   mask         IN      MDSYS.SDO_GEORASTER DEFAULT NULL,
   storageParam IN      VARCHAR2,
   outGeoraster IN OUT  MDSYS.SDO_GEORASTER,
   zeroMapping  IN      NUMBER DEFAULT 0,
   oneMapping   IN      NUMBER DEFAULT 1,
   bgValues     IN      MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);



--
-- NAME:
--      subset procedure
--
-- DESCRIPTION
--      This procedure does either spatial crop/cut/clip, or layer/band
--      subset, or both.
--
-- ARGUMENTS
--      inGeoRaster    - The source SDO_GEORASTER object 
--      pyramidLevel   - The pyramid level of the source GeoRaster object
--      cropArea       - The crop area. If it is of SDO_GEOMETRY type, 
--                       it can be in any coordinate space. If it is 
--                       of SDO_NUMBER_ARRAY, it is in cell space only
--      layerNumbers   - The logical layers 
--      bandNumbers    - The physical bands in cell space
--      storageParam   - A string specifying storage parameters for the result.
--                       The details are explained in GeoRaster Manual
--      outGeoRaster   - The new GeoRaster Object
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE subset
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   cropArea       IN MDSYS.SDO_GEOMETRY,
   layerNumbers   IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   polygonClip    IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE subset
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   cropArea       IN MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers    IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE subset  
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel   IN NUMBER,
   cropArea       IN MDSYS.SDO_GEOMETRY,
   layerNumbers   IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   polygonClip    IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE subset
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel   IN NUMBER,
   cropArea       IN MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers    IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      scale procedure
--
-- DESCRIPTION
--      This procedure enlarges or reduces a georaster object and 
--      overwrites it.
--
-- ARGUMENTS
--      inGeoRaster    - The source SDO_GEORASTER object
--      scaleParam     - The scale factor or factors
--      resampleParam  - The resampling method
--      storageParam   - A string specifying storage parameters for the result
--                       The details are explained in GeoRaster Manual
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE scale
(
   inGeoRaster    IN OUT MDSYS.SDO_GEORASTER,
   scaleParam     IN VARCHAR2,
   resampleParam  IN VARCHAR2,
   storageParam   IN VARCHAR2,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);


--
-- NAME:
--      scaleCopy procedure
--
-- DESCRIPTION
--      This procedure enlarges or reduces a georaster object and
--      write the result as another georaster object.
--
-- ARGUMENTS
--      inGeoRaster    - The source SDO_GEORASTER object
--      pyramidLevel   - The pyramid level of the source GeoRaster object
--      scaleParam     - The scale factor or factors
--      resampleParam  - The resampling method
--      storageParam   - A string specifying storage parameters for the result
--                       The details are explained in GeoRaster Manual
--      outGeoRaster   - The new GeoRaster Object
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE scaleCopy
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   scaleParam     IN VARCHAR2,
   resampleParam  IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE scaleCopy
(
   inGeoRaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel   IN NUMBER,
   scaleParam     IN VARCHAR2,
   resampleParam  IN VARCHAR2,
   storageParam   IN VARCHAR2,
   outGeoRaster   IN OUT MDSYS.SDO_GEORASTER,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);


-- 
-- NAME
--   generateBitmapPyramid
--
-- DESCRIPTION
--   This routine generates bitmap pyramid
--
-- ARGUMENTS  
--   src_geor   source bitmap raster
--   tmp_geor   temporary raster
--   target_geor result bitmap raster with fully pyramids generated
--   pyramidParams  pyramid parameter
--   bgvalues    background values
--   parallelParam parallel parameter
--   addColormap to indicate if adding optional colormap
--
PROCEDURE generateBitmapPyramid
(
  src_geor      IN MDSYS.SDO_GEORASTER, 
  tmp_geor      IN OUT MDSYS.SDO_GEORASTER, 
  target_geor   IN OUT MDSYS.SDO_GEORASTER,
  pyramidParams IN VARCHAR2,
  bgValues      IN MDSYS.SDO_NUMBER_ARRAY,
  parallelParam IN VARCHAR2 DEFAULT NULL,  
  addColormap   IN NUMBER DEFAULT 1
);

--
-- NAME:
--      generatePyramid
--
-- DESCRIPTION
--      This procedure generates pyramids, which are stored together with
--      the original data.
--
--ARGUMENTS
--      georaster     - The source SDO_GEORASTER object      
--      pyramidParams - The pyramid parameters
--      bgValues       - background values for filling sparse data
--      parallelParam    - The parameter related to parallel processing. 
--                         Currently we only support 
--                           "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
--      A GeoRaster object 
--
PROCEDURE generatePyramid
( 
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   pyramidParams IN     VARCHAR2,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   parallelParam  IN     VARCHAR2 DEFAULT NULL
);


--
-- NAME:
--      deletePyramid
--
-- DESCRIPTION
--      This procedure deletes pyramids of a georaster object.
-- All levels of the pyramids that are greater or equal to pyramidLevel 
-- are removed. 
--
--ARGUMENTS
--      georaster     - The source SDO_GEORASTER object
--      pyramidLevel  - Specifies the minimal pyramid level to be deleted
--
-- RETURNS
--      A GeoRaster object
--
PROCEDURE deletePyramid
(
     georaster IN OUT MDSYS.SDO_GEORASTER,
     pyramidLevel IN NUMBER DEFAULT NULL 
);


--
-- NAME:
--      generateSpatialExtent
--
-- DESCRIPTION
--      This function generates the spatialExtent of a georaster object
--      using its SRS (spatial reference system) information.
--      The srid of the generated spatialExtent is decided by the SRS.
--      The srid is null if the georaster object is not referenced.
--
--ARGUMENTS
--      georaster - The GeoRaster object on which the spatialExtent is
--                  to be generated
--      height    - Z value in the 3D GeoReference system
--  
-- RETURNS
--      the spatialExtent geometry
--
FUNCTION generateSpatialExtent
(
   georaster  IN MDSYS.SDO_GEORASTER,
   height     IN NUMBER DEFAULT NULL
)
return MDSYS.SDO_GEOMETRY DETERMINISTIC PARALLEL_ENABLE;

--
-- NAME:
--      mosaic
--
-- DESCRIPTION
--      This procedure mosaics multiple GeoRaster objects into one. The
--      source GeoRaster objects must be prepared tiles or blocks that
--      are rectified and referenced onto the same coordinate system
--      with affine transformation. They must have the same number of 
--      layers/bands and must be spatially aligned along the row and column 
--      dimensions. They must also have the same mapping between the band 
--      and layer numbers.
--
--ARGUMENTS
--      georasterTableName  - the table containing all source georaster objects
--      georasterColumnName - the column of the georasterTable, in which all
--                            georaster objects are to be masaicked
--      georaster           - the result, i.e., the mosaic georaster object
--      storageParam        - storage parameter specification
--      bgValues            - background values for filling in the gaps
--  
-- RETURNS
--      a mosaic georaster object
--
PROCEDURE mosaic
(
   georasterTableName  IN     VARCHAR2,
   georasterColumnName IN     VARCHAR2,
   georaster           IN OUT MDSYS.SDO_GEORASTER,
   storageParam        IN     VARCHAR2,
   bgValues            IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      validateForMosaic
--
-- DESCRIPTION
--      check whether tiles in the given table are mosaickable
--
-- ARGUMENTS
--      georasterTableName  - the table containing all source georaster objects
--      georasterColumnName - the column of the georasterTable, in which all
--                            georaster objects are to be masaicked
--      resultTableName     - the name of the table to store the result
-- NOTES
--   A result table must be created before calling this procedure. The format 
--   of the result table is: 
--    (description VARCHAR2(80) NOT NULL, rowid1 ROWID, rowid2 ROWID)
--
PROCEDURE validateForMosaic
(
   georasterTableName  IN VARCHAR2,
   georasterColumnName IN VARCHAR2,
   resultTableName     IN VARCHAR2
);


-- NAME:
--      mosaic
--
-- DESCRIPTION
--      This procedure mosaics multiple GeoRaster objects retrieved from a
--      cursor and return the mosaicked image in the specified window of
--      interest. The source GeoRaster objects must be prepared tiles or 
--      blocks that are rectified and referenced onto the same coordinate 
--      system with affine transformation. They must have the same number of 
--      layers/bands and must be spatially aligned along the row and column 
--      dimensions. They must also have the same mapping between the band 
--      and layer numbers.
--
--ARGUMENTS
--      georasters          - the source georaster objects
--      pyramidLevel        - the pyramid level 
--      window              - the cropping window
--      layerNumbers        - layer numbers 
--      georaster           - the result, i.e., the mosaic georaster object
--      storageParam        - storage parameter specification
--      bgValues            - background values for filling in the gaps
--  
--  
PROCEDURE mosaic
(
 inGeoRasters        IN     SYS_REFCURSOR,
 pyramidLevel        IN     NUMBER,
 window              IN     MDSYS.SDO_GEOMETRY,      
 layerNumbers        IN     VARCHAR2,   
 outGeoRaster        IN OUT MDSYS.SDO_GEORASTER,
 storageParam        IN     VARCHAR2,
 bgValues            IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      mergeLayers
--
-- DESCRIPTION
--      append selected layers of a GeoRaster object to another GeoRaster object
--
-- ARGUMENTS
--      targetGeoraster    - the GeoRaster object to be appended to
--      sourceGeoraster    - the source GeoRaster object
--      sourceLayerNumbers - source layers to be appended to the target
--      bgValues           - background filling values
--      
-- NOTES
--   The source and target GeoRaster objects must have the same row and cloumn 
--   dimension sizes. They also must cover the same area in the model (if both
--   are georeferenced) or cell (if neither is georeferenced) space.
--
PROCEDURE mergeLayers(
   targetGeoraster     IN OUT MDSYS.SDO_GEORASTER, 
   sourceGeoraster     IN     MDSYS.SDO_GEORASTER, 
   sourceLayerNumbers  IN     VARCHAR2 DEFAULT NULL,
   bgValues            IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
); 

--
-- NAME:
--     mergeLayers 
--
-- DESCRIPTION
--      union selected layers of two GeoRaster objects to generate a new 
--      GeoRaster object
--
-- ARGUMENTS
--      source1Georaster    - the first source GeoRaster object
--      source1LayerNumbers - source layers of the first object to be included
--      source2Georaster    - the second GeoRaster object
--      source2LayerNumbers - source layers of the second object to be included
--      storageParam        - the storage parameter for the output object
--      outGeoraster        - the result GeoRaster object
--      bgValues            - background filling values
--      pyramidLevel        - union the layers on the pyramidLevel
-- NOTES
--   The two source GeoRaster objects must have the same row and cloumn 
--   dimension sizes and the same georeferencing.
--
--   If storageParam is NULL, the result object has the same storage 
--   attributes as those of the first source object.
--
PROCEDURE mergeLayers(
   source1Georaster     IN     MDSYS.SDO_GEORASTER, 
   source1LayerNumbers  IN     VARCHAR2,
   source2Georaster     IN     MDSYS.SDO_GEORASTER, 
   source2LayerNumbers  IN     VARCHAR2,
   storageParam         IN     VARCHAR2,
   outGeoraster         IN OUT MDSYS.SDO_GEORASTER,
   bgValues             IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   pyramidLevel         IN     NUMBER DEFAULT NULL
);

--
-- NAME:
--     updateRaster
--
-- DESCRIPTION
--     Update a specified area or the overlapping parts of one GeoRaster 
--     object with selected bands or layers of another GeoRaster object. 
--
-- ARGUMENTS
--     targetGeoraster    - the GeoRaster object to be updated
--     targetPyramidLevel - the target pyramid level to be updated
--     targetLayerNumbers - the layers to be updated
--     targetBandNumbers  - the bands to be updated
--     targetArea         - the area to be updated
--     sourceGeoraster    - the source GeoRaster object
--     sourcePyramidLevel - the source pyramid level
--     sourceLayerNumbers - the source layers to be considered
--     sourceBandNumbers  - the source bands to be considered
--     updateUpperPyramids - whether to update upper level pyramids
--     bgValues           - background filling values
--
-- NOTES
--   If georeferenced, both objects should be in the same coordinate system. 
--   Both GeoRaster objects should have the same cell depth and spatial 
--   resolution (if georeferenced).
--   If both are not georeferenced, the UTLCoordinates will be considered to 
--   co-locate them into each other.
--   The two georaster objects could have different dimensions and sizes. 
--   If targetArea is not specified (NULL), all the overlapping parts are
--   updated.
--   The band/layer numbers should have a one-to-one matching. 
--   If the source georaster object is not large enough to fill in the target 
--   area, the uncovered area will not be updated.
--   If the source georaster object is sparse, background filling values
--   are considered.
--   If the target GeoRaster objects has pyramids and/or is compressed, the 
--   updates should be automatically reflected in the pyramids and/or be 
--   compressed as well.
--
PROCEDURE updateRaster( 
   targetGeoraster    IN OUT MDSYS.SDO_GEORASTER, 
   targetPyramidLevel IN     NUMBER,
   targetLayerNumbers IN     VARCHAR2, 
   targetArea         IN     MDSYS.SDO_GEOMETRY, 
   sourceGeoraster    IN     MDSYS.SDO_GEORASTER, 
   sourcePyramidLevel IN     NUMBER,
   sourceLayerNumbers IN     VARCHAR2,
   updateUpperPyramids IN    VARCHAR2,
   bgValues           IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
); 

PROCEDURE updateRaster( 
   targetGeoraster    IN OUT MDSYS.SDO_GEORASTER, 
   targetPyramidLevel IN     NUMBER,
   targetBandNumbers  IN     VARCHAR2, 
   targetArea         IN     MDSYS.SDO_NUMBER_ARRAY,
   sourceGeoraster    IN     MDSYS.SDO_GEORASTER, 
   sourcePyramidLevel IN     NUMBER,
   sourceBandNumbers  IN     VARCHAR2,
   updateUpperPyramids IN    VARCHAR2,
   bgValues           IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL 
); 

--
-- NAME:
--     createTemplate
--
-- DESCRIPTION
--     Generate template metadata for a georaster object, and optionally
--     insert entries with empty raster blocks into the RDT.
--
-- ARGUMENTS
--     georaster       - the georaster object
--     rasterType      - the raster type
--     rasterSpec      - the raster specification
--     maskLayers      - layers with bitmap mask
--     initRdtEntry    - whether to insert the RDT entries
--
-- NOTES
--
PROCEDURE createTemplate
(
   georaster   IN OUT MDSYS.SDO_GEORASTER,
   rasterType      IN NUMBER, 
   rasterSpec      IN VARCHAR2,
   maskLayers      IN VARCHAR2 DEFAULT NULL,
   initRdtEntry    IN VARCHAR2 DEFAULT NULL
);

--
-- NAME:
--     getRasterBlockLocator
--
-- DESCRIPTION
--     Get the LOB locator of a specified raster block
--
-- ARGUMENTS
--     georaster       - the source GeoRaster object
--     pyramidLevel    - the pyramid level
--     bandBlockNumber - the band block number
--     rowBlockNumber  - the row block number
--     colBlockNumber  - the column block number
--     loc             - the in/out lob locator
--     isBitmapMask    - 'true' if access a rasterblock of a bitmap mask
--     lock_for_write  - lock for write
--
-- NOTES
--     If the value for isBitmapMask is not 'true' (case insensitive),
--     a regular raster block is accessed; otherwise, a bitmap mask block
--     is being accessed.
--
--     If the value for lock_for_write is not 'true' (case insensitive),
--     the row in the RDT is not locked.
--
PROCEDURE getRasterBlockLocator
(
   georaster         IN MDSYS.SDO_GEORASTER,
   pyramidLevel      IN NUMBER,
   bandBlockNumber   IN NUMBER,
   rowBlockNumber    IN NUMBER,
   columnBlockNumber IN NUMBER,
   loc               IN OUT NOCOPY BLOB,
   isBitmapMask      IN VARCHAR2 DEFAULT NULL,
   lock_for_write    IN VARCHAR2 DEFAULT NULL
);

--
-- NAME:
--      getRasterBlockLocator procedure
--
-- DESCRIPTION
--      The procedure retrieve the raster block locator which 
--      contains a single cell located anywhere in the georaster 
--      object by specifying its row/column/band numbers in its 
--      cell coordinate space  or by specifying a point geometry 
--      in either model coordinate space or cell coordinate space
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      rowNumber       - row number in cell space
--      colNumber       - column number in cell space
--      bandNumber      - band number in cell space (not model space)
--      layerNumber     - logical layer number 
--      ptGeom          - a point geometry in either cell space
--                        or model space
-- RETURNS
--      
--
PROCEDURE getRasterBlockLocator
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   rowNumber    IN NUMBER,
   colNumber    IN NUMBER,
   bandNumber   IN NUMBER,
   offset       out NUMBER,
   loc          IN OUT NOCOPY BLOB,
   isBitmapMask      IN VARCHAR2 DEFAULT NULL,
   lock_for_write    IN VARCHAR2 DEFAULT NULL
);

PROCEDURE getRasterBlockLocator
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layerNumber  IN NUMBER,
   offset       out NUMBER,
   loc          IN OUT NOCOPY BLOB,
   isBitmapMask      IN VARCHAR2 DEFAULT NULL,
   lock_for_write    IN VARCHAR2 DEFAULT NULL
);
--
-- NAME:
--     getRasterRange
--
-- DESCRIPTION
--     Get the minimum and maximum cell values of a layer of a GeoRaster object 
--     or the object itself (i.e., layerNumber = 0).
--
-- ARGUMENTS
--     georaster       - the source GeoRaster object
--     layerNumber     - the layer number, 0 for object layer
--
-- NOTES
--
FUNCTION getRasterRange
(
    georaster            IN MDSYS.SDO_GEORASTER, 
    layerNumber          IN NUMBER DEFAULT 0 
) RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE; 


-- 
-- NAME:
--   validateBlockMBR
--
-- DESCRIPTION
--   check whether the blockMBR geometries in the RDT are valid
-- 
-- ARGUMENTS
--   georaster - the GeoRaster object whose blockMBRs are to be checked
-- 
-- RETURNS
--   'NULL' if the GeoRaster object is NULL;
--   'TRUE' if the blockMBRs are valid; 
--    otherwise an error number
--
-- NOTES
--   Each blockMBR is a rectangle defined in the cell space and must be 
--   IDENTICAL to following geometry, respectively:
--     MDSYS.SDO_GEOMETRY(2003,NULL,NULL,
--               MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,3),
--               MDSYS.SDO_ORDINATE_ARRAY(R0+rowBlockNumber*RSZ,
--                         C0+columnBlockNumber*CSZ,
--                         R0+(rowBlockNumber+1)*RSZ-1,
--                         C0+(columnBlockNumber+1)*CSZ-1)) 
--   where:
--     R0 is the upper-left row coordinate in the cell space; 
--     C0 is the upper-left column coordinate in the cell space;
--     RSZ is the row block size;
--     CSZ is the column block size

--   The dimension information of a blockMBR geometry must be in the order 
--   of (ROW, COLUMN).

FUNCTION validateBlockMBR
(
   georaster IN MDSYS.SDO_GEORASTER
) RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

-- 
-- NAME:
--   generateBlockMBR
--
-- DESCRIPTION
--   generate correct blockMBR geometries in the RDT
--  
-- ARGUMENTS
--   georaster - the GeoRaster object whose blockMBRs are to be generated
-- 
-- NOTES
--   The raster rows in the RDT are updated with the correct blockMBR values,
--   but the GeoRaster object itself is not changed.
--
PROCEDURE generateBlockMBR
(
   georaster IN MDSYS.SDO_GEORASTER
);

-- ---------------------------------------------------------------------
--  Compress and Decompress GeoRaster Objects
--  
--  They are all embedded into "storageParam" in related procedures
--  using keyword "compression"
-- ---------------------------------------------------------------------
--
-- NAME:
--      calcCompressionRatio function
--
-- DESCRIPTION
--      calculates the compression ratio of a compressed GeoRaster
--      object on the fly.
--
-- ARGUMENTS
--      georaster  - The compressed SDO_GEORASTER object
--
-- RETURNS
--      A Number
--
FUNCTION calcCompressionRatio
(
   georaster IN MDSYS.SDO_GEORASTER
) 
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;


-- ---------------------------------------------------------------------
--  Update/Modify/Change GeoRaster Object Cell (or say, Raster) Data
--
--  These functions will change cell values, so use them cautiously.
-- ---------------------------------------------------------------------
--
-- NAME:
--      changeCellValue procedure
--
-- DESCRIPTION
--      This procedure changes all cells inside a window of each 
--      specified layer/band to have a specified value
--
-- ARGUMENTS
--      georaster      - The SDO_GEORASTER object to be changed
--      window         - The window inside which each cell will be changed
--                       to have the newCellValue. If it is of SDO_GEOMETRY type, 
--                       it can be in any coordinate space. If it is 
--                       of SDO_NUMBER_ARRAY, it is in cell space only
--      layerNumbers   - The logical layers whose cells to be changed
--      bandNumbers    - The physical bands in cell space to be changed
--      newCellValue   - the new cell value for each cell inside the window
--                       of each specified band/layer
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      the source GeoRaster object with cells changed
--
PROCEDURE changeCellValue
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   window        IN     MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers   IN     VARCHAR2,
   newCellValue  IN     NUMBER,
   bgValues      IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE changeCellValue
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   window        IN     MDSYS.SDO_GEOMETRY,
   layerNumbers  IN     VARCHAR2,
   newCellValue  IN     NUMBER,
   bgValues      IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      changeCellValues procedure
--
-- DESCRIPTION
--      The procedure changes the values of one or more cells 
--      located anywhere in the georaster object by specifying
--      its row/column/band numbers in its cell coordinate space
--      or by specifying a multipoint geometry in either model 
--      coordinate space or cell coordinate space
--
-- ARGUMENTS
--      georaster      - The SDO_GEORASTER object to be changed
--      rowNumbers     - row numbers in cell space
--      colNumbers     - column numbers in cell space
--      layerNumber    - The logical layer whose cell to be changed
--      bandNumber     - The physical band in cell space to be changed
--      newCellValues  - the new cell values for each cell
--      bgValues       - background values for filling sparse data
--
-- RETURNS
--      the source GeoRaster object with cells changed
--
PROCEDURE changeCellValues
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   rowNumbers    IN     MDSYS.SDO_NUMBER_ARRAY,
   colNumbers    IN     MDSYS.SDO_NUMBER_ARRAY,
   bandNumber    IN     NUMBER,
   newCellValues IN     MDSYS.SDO_NUMBER_ARRAY,
   bgValues      IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE changeCellValues
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   ptGeom        IN     MDSYS.SDO_GEOMETRY,
   layerNumber   IN     NUMBER,
   newCellValues IN     MDSYS.SDO_NUMBER_ARRAY,
   bgValues      IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

-- ---------------------------------------------------------------------
--    Georeference GeoRaster Objects
-- 
-- Other georeferencing or related functions include:
-- 1. setSRS() adds, modifies and deletes georeferencing info
-- 2. importFrom() loads ArcInfo World File from file or CLOB
-- 3. the tool GeoRasterLoader loads ArcInfo World File from file
-- ---------------------------------------------------------------------

--
-- NAME:
--      georeference
--
-- DESCRIPTION
--      georeference a GeoRaster object using the provided
--      cell-to-model transformation coefficients.
--      in 10iR1, it means the following affine transformation:
--        x = A * col + B * row + C
--        y = D * col + E * row + F
--      where A, B, C, D, E, F are given coefficients.
--      The result will be the following model-to-cell tranformation:
--        row = a + b * x + c * y 
--        col = d + e * x + f * y
--      where a, b, c, d, e, f will be stored in the SRS of the 
--      GeoRaster object.
--
--      NOTE: the spatial resolutions might not be set by this function.
--            If so, call setSpatialResolutions() to do it separately.
--
-- ARGUMENTS
--      georaster      - the georaster object to be georeferenced
--      srid           - the model space onto which the georaster object
--                       is to be georeferenced
--      modelCoordinateLocation -
--                       the modelCoordinateLocation of each cell/pixel,
--                       only CENTER (0) and UPPERLEFT (1) are allowed.
--      xCoefficients  - A, B, C
--      yCoefficients  - D, E, F
--
-- RETURNS
--      the input georaster object for update.
--      the original existing SRS (if any) is overwritten.
--
PROCEDURE georeference
(
   georaster               IN OUT MDSYS.SDO_GEORASTER,
   srid                    IN     NUMBER,
   modelCoordinateLocation IN     NUMBER,
   xCoefficients           IN     MDSYS.SDO_NUMBER_ARRAY,
   yCoefficients           IN     MDSYS.SDO_NUMBER_ARRAY
);


-- ---------------------------------------------------------------------
--           Query GeoRaster Object Cell (or say, Raster) Data
-- ---------------------------------------------------------------------

--
-- NAME:
--      getModelCoordinate
--
-- DESCRIPTION
--      Given a spatial coordinate, i.e., (row, column, vertical) of
--      a cell in the cell coordinate space, its corresponding spatial 
--      coordinate (X, Y, Z) in the model coordinate space
--      is calculated and returned.
--
-- ARGUMENTS
--      georaster      - the georaster object to query upon.
--      pyramidLevel   - the pyramid level in which the cell is.
--      cellCoordinate - number array containing row, column, 
--                       and vertical if its spatial dimension is 3
--      modelCoordinate - a SDO_GEOMETRY object in the model space that 
--                        contains X, Y and/or Z
--      height         - Z value in 3D GeoReference system
--
-- RETURNS
--      a SDO_GEOMETRY object containing X, Y and/or Z
--
FUNCTION getModelCoordinate
(
   georaster         IN MDSYS.SDO_GEORASTER,
   pyramidLevel      IN NUMBER,
   cellCoordinate    IN MDSYS.SDO_NUMBER_ARRAY,
   height            IN NUMBER DEFAULT NULL
)
RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC PARALLEL_ENABLE;

PROCEDURE getModelCoordinate
(
   georaster         IN MDSYS.SDO_GEORASTER,
   pyramidLevel      IN NUMBER,
   cellCoordinate    IN MDSYS.SDO_GEOMETRY,
   modelCoordinate   OUT MDSYS.SDO_GEOMETRY,
   height            IN NUMBER DEFAULT NULL
);

--
-- NAME:
--      getCellCoordinate
--
-- DESCRIPTION
--      Given a spatial coordinate, i.e., (X, Y, Z) of a point in the model
--      coordinate space, its corresponding spatial coordinate (row, column,
--      vertical) in the cell coordinate space is calculated and returned.
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the pyramid level in which the cell is.
--      modelCoordinate - a SDO_GEOMETRY point containing X, Y, 
--                        and Z if its spatial dimension is 3
--      subCell         - whether floating cell coordinates are returned
--
-- RETURNS
--      either a cellCoordinate array or a SDO_GEOMETRY object containing 
--      row, column and/or vertical
--
-- NOTES
--      If the output type is MDSYS.SDO_NUMBER_ARRY, the input must be a point
--      geometry; otherwise, the input can be geometry of any types
--
--      Cell coordinates are returned as floating numbers if subCell is 
--      'TRUE' (case insensitive). Otherwise, they are returned as integers.
--
FUNCTION getCellCoordinate
(
   georaster         IN MDSYS.SDO_GEORASTER,
   pyramidLevel      IN NUMBER,
   modelCoordinate   IN MDSYS.SDO_GEOMETRY,
   subCell           IN VARCHAR2 DEFAULT NULL,
   height            IN NUMBER DEFAULT NULL,
   vert_id           IN NUMBER DEFAULT NULL,
   ellipsoidal       IN VARCHAR2 DEFAULT NULL
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

PROCEDURE getCellCoordinate
(
   georaster         IN MDSYS.SDO_GEORASTER,
   pyramidLevel      IN NUMBER,
   modelCoordinate   IN MDSYS.SDO_GEOMETRY,
   cellCoordinate    OUT MDSYS.SDO_GEOMETRY,
   subCell           IN VARCHAR2 DEFAULT NULL,
   height            IN NUMBER DEFAULT NULL,
   vert_id           IN NUMBER DEFAULT NULL,
   ellipsoidal       IN VARCHAR2 DEFAULT NULL
);

--
-- NAME:
--      getCellCoordinate
--
-- DESCRIPTION
--      Convert cell coordinates between different pyramid levels.
--
-- ARGUMENTS
--      georaster            - the georaster object to query upon
--      sourcepyramidLevel   - the source pyramid level 
--      sourceCellCoordinate - the source cell coordinates
--      targetPyramidLevel   - the target pyramid level
--      subCell           - whether floating cell coordinates are returned
--
-- RETURNS
--      either a sdo_number_array or a SDO_GEOMETRY object containing 
--      the corresponding cell coordinates at the target pyramid level.
--
-- NOTES
--      Cell coordinates are returned as floating numbers if subCell is 
--      'TRUE' (case insensitive). Otherwise, they are returned as integers.
--

FUNCTION getCellCoordinate
(
   georaster            IN MDSYS.SDO_GEORASTER,
   sourcePyramidLevel   IN NUMBER,
   sourceCellCoordinate IN MDSYS.SDO_NUMBER_ARRAY,
   targetPyramidLevel   IN NUMBER,
   subCell              IN VARCHAR2 DEFAULT NULL
) RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellCoordinate
(
   georaster            IN MDSYS.SDO_GEORASTER,
   sourcePyramidLevel   IN NUMBER,
   sourceCellCoordinate IN MDSYS.SDO_GEOMETRY,
   targetPyramidLevel   IN NUMBER,
   subCell              IN VARCHAR2 DEFAULT NULL
) RETURN MDSYS.SDO_GEOMETRY DETERMINISTIC PARALLEL_ENABLE;

--
-- NAME:
--      getCellValue functions
--
-- DESCRIPTION
--      The functions retrieve the value of a single cell 
--      located anywhere in the georaster object by specifying
--      its row/column/band numbers in its cell coordinate space
--      or by specifying a point geometry in either model 
--      coordinate space or cell coordinate space
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      rowNumber       - row number in cell space
--      colNumber       - column number in cell space
--      bandNumber      - band number in cell space (not model space)
--      layerNumber     - logical layer number 
--      ptGeom          - a point geometry in either cell space
--                        or model space
-- RETURNS
--      Number
--
FUNCTION getCellValue
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   rowNumber    IN NUMBER,
   colNumber    IN NUMBER,
   bandNumber   IN NUMBER
) 
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellValue
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layerNumber  IN NUMBER
) 
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellValue
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   rowNumber    IN NUMBER,
   colNumber    IN NUMBER,
   bands        IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellValue
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layers       IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

--
-- NAME:
--      getCellValues functions
--
-- DESCRIPTION
--      The functions retrieve the values of one or more cells 
--      located anywhere in the georaster object by specifying
--      its row/column/band numbers in its cell coordinate space
--      or by specifying a multipoint geometry in either model 
--      coordinate space or cell coordinate space
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      rowNumbers      - row numbers in cell space
--      colNumbers      - column numbers in cell space
--      bandNumber      - band number in cell space (not model space)
--      layerNumber     - logical layer number 
--      ptGeom          - a multipoint geometry in either cell space
--                        or model space
-- RETURNS
--      SDO_NUMBER_ARRAY
--
FUNCTION getCellValues
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   rowNumbers   IN MDSYS.SDO_NUMBER_ARRAY,
   colNumbers   IN MDSYS.SDO_NUMBER_ARRAY,
   bandNumber   IN NUMBER
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellValues
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layerNumber  IN NUMBER
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

--
-- NAME:
--      evaluate functions
--
-- DESCRIPTION
--      Based on different interpolation methods specified by parameter 
--      interpolationMethod, the functions will evaluate and return values
--      for the cells located anywhere in the georaster object by specifying
--      its row/column/band numbers in its cell coordinate space
--      or by specifying a point geometry in either model 
--      coordinate space or cell coordinate space
--      The only difference between evaluate and evaluateDouble is that evaluate
--      returns values based on the georaster object cellDepth, but evaluateDouble 
--      always returns double numbers.
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      row             - row number in cell space
--      column          - column number in cell space
--      bands           - band number array in cell space (not model space)
--      layers          - logical layer number array 
--      ptGeom          - a point geometry in either cell space
--                        or model space
-- RETURNS
--      SDO_Number_array
--
--FUNCTION evaluate
--(
--   georaster    IN MDSYS.SDO_GEORASTER,
--   pyramidLevel IN NUMBER,
--   row          IN NUMBER,
--   column       IN NUMBER,
--   bands        IN VARCHAR2,
--   interpolationMethod  IN VARCHAR2
--) 
--RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

--FUNCTION evaluate
--(
--   georaster    IN MDSYS.SDO_GEORASTER,
--   pyramidLevel IN NUMBER,
--   ptGeom       IN MDSYS.SDO_GEOMETRY,
--   layers       IN VARCHAR2,
--   interpolationMethod  IN VARCHAR2
--) 
--RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION evaluateDouble
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   row          IN NUMBER,
   column       IN NUMBER,
   bands        IN VARCHAR2,
   interpolationMethod  IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION evaluateDouble
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layers       IN VARCHAR2,
   interpolationMethod  IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

--
-- NAME:
--      evaluateDoubles functions
--
-- DESCRIPTION
--      Based on different interpolation methods specified by parameter 
--      interpolationMethod, the functions will evaluate and return values
--      for the cells located anywhere in the georaster object by specifying
--      its rows/columns/band numbers in its cell coordinate space
--      or by specifying a multipoint geometry in either model 
--      coordinate space or cell coordinate space
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      rows            - row numbers in cell space
--      cols            - column numbers in cell space
--      band            - band number in cell space (not model space)
--      layer           - logical layer number
--      ptGeom          - a multipoint geometry in either cell space
--                        or model space
-- RETURNS
--      MDSYS.SDO_NUMBER_ARRAY

FUNCTION evaluateDoubles
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   rows         IN MDSYS.SDO_NUMBER_ARRAY,
   cols         IN MDSYS.SDO_NUMBER_ARRAY,
   band         IN NUMBER,
   interpolationMethod  IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION evaluateDoubles
(
   georaster    IN MDSYS.SDO_GEORASTER,
   pyramidLevel IN NUMBER,
   ptGeom       IN MDSYS.SDO_GEOMETRY,
   layer        IN NUMBER,
   interpolationMethod  IN VARCHAR2
) 
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;


--
-- NAME:
--      getRasterBlocks functions
--
-- DESCRIPTION
--      This function returns a sdo_rasterset table containing
--      all sub-blocks of the specified pramid level which are
--      inside and touch the given window
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      window          - a rectanglar window in cell space
--
-- RETURNS
--      MDSYS.SDO_RASTERSET
--
FUNCTION getRasterBlocks
(
   georaster        IN MDSYS.SDO_GEORASTER,
   pyramidLevel     IN NUMBER,
   window           IN MDSYS.SDO_NUMBER_ARRAY
)
return MDSYS.SDO_RASTERSET DETERMINISTIC;

--
-- NAME:
--      getRasterBlocks functions
--
-- DESCRIPTION
--      This function returns a sdo_rasterset table containing
--      all sub-blocks of the specified pramid level which are
--      inside and touch the given window
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      window          - a SDO geometry
--
-- RETURNS
--      MDSYS.SDO_RASTERSET
--
FUNCTION getRasterBlocks
(
   georaster        IN MDSYS.SDO_GEORASTER,
   pyramidLevel     IN NUMBER,
   window           IN MDSYS.SDO_GEOMETRY
)
return MDSYS.SDO_RASTERSET DETERMINISTIC;


--
-- NAME:
--      getRasterSubset
--
-- DESCRIPTION
--      This function returns a single blob holding the mosaic of
--      all sub-blocks of the specified pramid level which are
--      inside and touch the given window
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      inWindow        - the window of interest
--      bandNumbers     - bandNumbers
--      rasterBlob      - holds the result, i.e., the mosaicked 
--                        raster subset
--      outWindow       - the output window
--      storageParam    - storage parameters for the output
--      bgValues        - background values
--
-- RETURNS
--      BLOB
--
-- NOTES
--      if the type of inWindow is SDO_NUMBER_ARRAY, it specifies a rectanglar
--      window in the cell space
--      outWindow contains the coordinates of the upper-left and bottom-right 
--      corners of the output window in the cell space
--
PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   window         IN     MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers    IN     VARCHAR2,
   rasterBlob     IN OUT NOCOPY BLOB,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers    IN     VARCHAR2,
   rasterBlob     IN OUT NOCOPY BLOB,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   window         IN     MDSYS.SDO_GEOMETRY,
   layerNumbers   IN     VARCHAR2,
   rasterBlob     IN OUT NOCOPY BLOB,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   polygonClip    IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_GEOMETRY,
   layerNumbers   IN     VARCHAR2,
   rasterBlob     IN OUT NOCOPY BLOB,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   polygonClip    IN     VARCHAR2 DEFAULT NULL
);


PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_NUMBER_ARRAY,
   bandNumbers    IN     VARCHAR2,
   rasterData     OUT    MDSYS.SDO_NUMBER_ARRAY,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);


PROCEDURE getRasterSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_GEOMETRY,
   layerNumbers   IN     VARCHAR2,
   rasterData     OUT    MDSYS.SDO_NUMBER_ARRAY,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
   polygonClip    IN     VARCHAR2 DEFAULT NULL
);


--
-- NAME:
--      getRasterSubset
--
-- DESCRIPTION
--      This function returns a nested table which holds 
--      cellvalue/pyramid/row/column/layer/(area or point)geometry of all cells
--      inside and touch the given window
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      inWindow        - the window of interest
--      layerNumber     - layer number
--      isPoint         - if it is 0 then returns a boundry polygon geometry for each cell, if it is 1 then returns 
--                        the central point geometry for each cell, the default value is 1.
--      bgValues        - background values
--      polygonClip     - if it is 'true' then just cells inside the window geometry get returned, otherwise all cells 
--                      - inside MBR of the window geometry get returned.
--
-- RETURNS
--      mdsys.sdo_geor_cell_table
--
--

FUNCTION getRasterSubset
  (
    georaster     IN MDSYS.SDO_GEORASTER,
    pyramidLevel  IN number default 0,
    inWindow      IN MDSYS.SDO_GEOMETRY default null,
    layerNumber   IN number default 1,
    pointPolygon  IN number default 1,
    bgValues      IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    polygonClip   IN VARCHAR2 DEFAULT NULL
  )RETURN mdsys.sdo_geor_cell_table
    PIPELINED;

--
-- NAME:
--      getRasterData
--
-- DESCRIPTION
--      This function returns a single blob holding all raster data
--      of the input georaster object at the specified pyramid level.
--      If it is blocked, the mosaic of all blocks of the specified
--      pramid level is returned.
--
-- ARGUMENTS
--      georaster       - the georaster object to query upon
--      pyramidLevel    - the level in pyramid
--      rasterBlob      - holds the result, i.e., the raster data 
--      storageParam    - storage parameters for the output
--      bgValues        - background values
--
-- RETURNS
--      BLOB
--
PROCEDURE getRasterData
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   pyramidLevel   IN     NUMBER,
   rasterBlob     IN OUT NOCOPY BLOB,
   storageParam   IN     VARCHAR2 DEFAULT NULL,
   bgValues       IN     MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);


-- ---------------------------------------------------------------------
--        Query GeoRaster Object Metadata and Ancillary Data
-- ---------------------------------------------------------------------

FUNCTION getVersion
(
  georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC  PARALLEL_ENABLE;

FUNCTION getID
(
  georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION isBlank
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBlankCellValue
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultColorLayer
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultRed
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultBlue
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultGreen
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultAlpha
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getDefaultPyramidLevel
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSpatialDimNumber
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSpatialDimSizes
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBandDimSize
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCellDepth
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getNODATA
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getULTCoordinate
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getInterleavingType
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getCompressionType
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBlockingType
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBlockSize
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getPyramidType
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getPyramidMaxLevel
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION isSpatialReferenced
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION isRectified
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION isOrthoRectified
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getModelSRID 
(
   georaster    IN MDSYS.SDO_GEORASTER
) 
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSpatialResolutions
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSRS
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_GEOR_SRS DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getModelCoordLocation
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBeginDateTime
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN TIMESTAMP WITH TIME ZONE DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getEndDateTime
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN TIMESTAMP WITH TIME ZONE DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSpectralUnit
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getSpectralResolution
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

-- for all layer-related get and set functions,
-- layerNumber = 0 means the object layer
-- layerDimension defaults to 'BAND' if not specified

FUNCTION getLayerDimension
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN MDSYS.SDO_STRING_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getTotalLayerNumber
(
   georaster    IN MDSYS.SDO_GEORASTER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getLayerOrdinate
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getLayerID
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getScaling
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBinType
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBinTable
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBinFunction
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getStatistics
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getHistogram
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_GEOR_HISTOGRAM DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getHistogramTable
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION hasGrayScale
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getGrayScale
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_GEOR_GRAYSCALE DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getGrayScaleTable
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION hasPseudoColor
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getColorMap
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN MDSYS.SDO_GEOR_COLORMAP DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getColorMapTable
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getVAT
(
   georaster    IN MDSYS.SDO_GEORASTER,
   layerNumber  IN NUMBER
)
RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;


-- ---------------------------------------------------------------------
--
--   statistics functions
--
-- ---------------------------------------------------------------------
Function generateAreaWeightedMean
( 
    georaster         IN MDSYS.SDO_GEORASTER,
    window            IN MDSYS.SDO_GEOMETRY,     
    bandNumber        IN NUMBER, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE'
) 
return NUMBER;

Function  generateStatistics
( 
    georaster         IN OUT MDSYS.SDO_GEORASTER,
    samplingFactor    IN VARCHAR2,  
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    histogram         IN VARCHAR2,
    layerNumbers      IN VARCHAR2 DEFAULT NULL,
    useBin            IN VARCHAR2 DEFAULT 'TRUE',
    binFunction       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    nodata            IN VARCHAR2 DEFAULT 'FALSE'
) 
return Varchar2; 

Function generateStatistics 
( 
    georaster         IN OUT MDSYS.SDO_GEORASTER, 
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    histogram         IN VARCHAR2,
    layerNumbers      IN VARCHAR2 DEFAULT NULL, 
    useBin            IN VARCHAR2 DEFAULT 'TRUE',
    binFunction       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    nodata            IN VARCHAR2 DEFAULT 'FALSE'
) 
return Varchar2;


Function  generateStatistics
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return MDSYS.SDO_NUMBER_ARRAY; 

Function generateStatistics
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return MDSYS.SDO_NUMBER_ARRAY;

Function generateStatisticsMax 
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMax 
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMin 
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMin 
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMean
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMean 
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;
Function generateStatisticsSTD
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsSTD
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;


Function generateStatisticsMedian
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMedian
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMode
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_NUMBER_ARRAY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

Function generateStatisticsMode
( 
    georaster         IN MDSYS.SDO_GEORASTER, 
    pyramidLevel      IN NUMBER,
    samplingFactor    IN VARCHAR2, 
    samplingWindow    IN MDSYS.SDO_GEOMETRY, 
    bandNumbers       IN VARCHAR2 DEFAULT NULL, 
    nodata            IN VARCHAR2 DEFAULT 'FALSE',
    polygonClip       IN VARCHAR2 DEFAULT NULL,
    parallelParam     IN VARCHAR2 DEFAULT NULL
) 
return NUMBER;

-- ---------------------------------------------------------------------
--    Update and Delete GeoRaster Object Metadata and Ancillary Data
--
--  SET procedures function as both UPDATE/MODIFY and DELETE.
--  In SET procedures, if the parameter is given as null, it will DELETE
--  the corresponding item/data in the georaster object only if the item 
--  is allowed to be deleted (optional or minOccurs=0 in xml schema) and
--  without other dependency and inter-relationship issues.
--  Validation will be done in those procedures in both cases.
--  To avoid losing data, use them cautiously.
-- ---------------------------------------------------------------------

-- change the last two digits only
PROCEDURE setRasterType
(
  georaster     IN OUT MDSYS.SDO_GEORASTER,
  rasterType    IN     NUMBER
);

PROCEDURE setID
(
  georaster     IN OUT MDSYS.SDO_GEORASTER,
  id            IN     VARCHAR2
);

PROCEDURE setBlankCellValue
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   value        IN     NUMBER
);

PROCEDURE setDefaultColorLayer
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultRGB   IN     MDSYS.SDO_NUMBER_ARRAY
);

PROCEDURE setDefaultRed
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultRed   IN     NUMBER
);

PROCEDURE setDefaultGreen
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultGreen IN     NUMBER
);

PROCEDURE setDefaultBlue
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultBlue  IN     NUMBER
);

PROCEDURE setDefaultAlpha
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultAlpha  IN     NUMBER
);

PROCEDURE setDefaultPyramidLevel
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   defaultPyramidLevel  IN     NUMBER
);

-- only if not spatial, temporal and band referenced 
PROCEDURE setULTCoordinate
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   ultCoord     IN     MDSYS.SDO_NUMBER_ARRAY
);

PROCEDURE setSpatialReferenced
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   isReferenced IN     VARCHAR2
);

-- set TRUE only if spatial referenced
PROCEDURE setRectified
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   isRectified  IN     VARCHAR2
);

-- set TRUE only if rectified
PROCEDURE setOrthoRectified
(
   georaster        IN OUT MDSYS.SDO_GEORASTER,
   isOrthoRectified IN     VARCHAR2
);

PROCEDURE setModelSRID 
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   srid         IN     NUMBER
);

PROCEDURE setSpatialResolutions
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   resolutions  IN     MDSYS.SDO_NUMBER_ARRAY
);

PROCEDURE setSRS
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   srs          IN     MDSYS.SDO_GEOR_SRS
);

-- value can be set only if spatial referenced
PROCEDURE setModelCoordLocation
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   modelCoordLoc IN     VARCHAR2
);


PROCEDURE setBeginDateTime
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   beginTime    IN     TIMESTAMP WITH TIME ZONE
);

PROCEDURE setEndDateTime
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   endTime      IN     TIMESTAMP WITH TIME ZONE
);

PROCEDURE setSpectralUnit
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   unit         IN     VARCHAR2
);

PROCEDURE setSpectralResolution
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   resolution   IN     NUMBER
);

PROCEDURE setLayerOrdinate
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   ordinate     IN     NUMBER
);

PROCEDURE setLayerID
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   id           IN     VARCHAR2
);

PROCEDURE setScaling
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   scalingFunc  IN     MDSYS.SDO_NUMBER_ARRAY
);

-- change binType if necessary
PROCEDURE setBinTable
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   tableName    IN     VARCHAR2
);

PROCEDURE setBinFunction(
   georaster   IN OUT MDSYS.SDO_GEORASTER,
   layerNumber IN     NUMBER,
   binFunction IN     MDSYS.SDO_NUMBER_ARRAY 
);

PROCEDURE setGrayScale
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   grayScale    IN     MDSYS.SDO_GEOR_GRAYSCALE
);

PROCEDURE setGrayScaleTable
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   tableName    IN     VARCHAR2
);

PROCEDURE setColorMap
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   colorMap     IN     MDSYS.SDO_GEOR_COLORMAP
);

PROCEDURE setColorMapTable
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   tableName    IN     VARCHAR2
);

PROCEDURE setVAT
(
   georaster    IN OUT MDSYS.SDO_GEORASTER,
   layerNumber  IN     NUMBER,
   vatName      IN     VARCHAR2
);

PROCEDURE setVersion
(
  georaster    IN OUT MDSYS.SDO_GEORASTER,
  majorVersion IN VARCHAR2,
  minorVersion IN VARCHAR2
);

PROCEDURE setStatistics
(
  georaster    IN OUT MDSYS.SDO_GEORASTER,
  layerNumber  IN NUMBER,
  statistics   IN MDSYS.SDO_NUMBER_ARRAY
);

--
-- NOTES
--   1) Whenever histogram is updated, new statistics must be provided.
--   2) If statistics is set with different samplingFactor/samplingWindow,
--      existing histogram is removed if not reset.
--   3) The samplingWindow must be inside the extent in the cell space.
--   4) If not specified, the default value for samplingFactor is 1.
--   5) If not specified, the default value for samplingWindow is the
--      whole image and it is removed from the metadata.
--
PROCEDURE setStatistics
(
  georaster    IN OUT MDSYS.SDO_GEORASTER,
  layerNumber  IN NUMBER,
  statistics   IN MDSYS.SDO_NUMBER_ARRAY,
  histogram    IN MDSYS.SDO_GEOR_HISTOGRAM,
  samplingFactor IN NUMBER DEFAULT NULL,
  samplingWindow IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

-- NOTES
--   1) The histogram table cannot be set if no statistics exist.
--   2) The histogram table is removed if histogramTable is NULL.
--   3) The samplingWindow must be inside the extent in the cell space.
--   4) If not specified, the default value for samplingFactor is 1.
--   5) If not specified, the default value for samplingWindow is the
--      whole image and it is removed from the metadata.
--
PROCEDURE setStatistics
(
  georaster    IN OUT MDSYS.SDO_GEORASTER,
  layerNumber  IN NUMBER,
  statistics   IN MDSYS.SDO_NUMBER_ARRAY,
  histogramTable IN VARCHAR2,
  samplingFactor IN NUMBER DEFAULT NULL,
  samplingWindow IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--PROCEDURE setHistogram
--(
--  georaster    IN OUT MDSYS.SDO_GEORASTER,
--  layerNumber  IN NUMBER,
--  histogram    IN MDSYS.SDO_GEOR_HISTOGRAM,
--  samplingFactor IN NUMBER DEFAULT NULL,
--  samplingWindow IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
--);

PROCEDURE setHistogramTable
(
  georaster    IN OUT MDSYS.SDO_GEORASTER,
  layerNumber  IN NUMBER,
  tableName    IN VARCHAR2
);

PROCEDURE setSourceInfo
(
   georaster   IN OUT MDSYS.SDO_GEORASTER, 
   sourceInfo  IN VARCHAR2
);

PROCEDURE addSourceInfo
(
   georaster   IN OUT MDSYS.SDO_GEORASTER,
   sourceInfo  IN VARCHAR2
);

FUNCTION getSourceInfo
(
   georaster   IN MDSYS.SDO_GEORASTER
) RETURN MDSYS.SDO_STRING2_ARRAY DETERMINISTIC PARALLEL_ENABLE;


-- ---------------------------------------------------------------------
--           multiple nodata values/value ranges
-- ---------------------------------------------------------------------
 
-- remove one NODATA value
PROCEDURE deleteNODATA
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   layerNumber   IN     NUMBER,
   NODATA        IN     NUMBER
);

-- remove multiple NODATA values or value ranges
PROCEDURE deleteNODATA
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   layerNumber   IN     NUMBER,
   NODATA        IN     MDSYS.SDO_RANGE_ARRAY
);

-- add one NODATA value
PROCEDURE addNODATA
(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   layerNumber   IN     NUMBER,
   NODATA        IN     NUMBER
);

-- add multiple NODATA values or value ranges
PROCEDURE addNODATA(
   georaster     IN OUT MDSYS.SDO_GEORASTER,
   layerNumber   IN     NUMBER,
   NODATA        IN     MDSYS.SDO_RANGE_ARRAY
);

-- retrieve all NODATA values and value ranges
FUNCTION getNODATA
(
   georaster     IN     MDSYS.SDO_GEORASTER,
   layerNumber   IN     NUMBER
) RETURN MDSYS.SDO_RANGE_ARRAY DETERMINISTIC  PARALLEL_ENABLE; 


-- ---------------------------------------------------------------------
--           Bitmap Mask Support
-- ---------------------------------------------------------------------

-- 
-- NAME:
--   setBitmapMask
--
-- DESCRIPTION
--   Attach, replace or remove a bitmap mask to a given GeoRaster layer
--
-- ARGUMENTS
--   georaster   - the GeoRaster object to be operated on
--   layerNumber - an object layer (0) or a subLayer (>0)
--   mask        - the 1BIT bitmap mask
--   NODATAMask  - spacifies whether the mask is going to be a NODATA mask
--
-- NOTES
--   If the GeoRaster object is NULL, nothing is to be done.
--   If the mask is NULL, any exisiting bitmap mask associated with the given
--   layer is removed.
--   If the mask is not a 1BIT GeoRaster object or has wrong dimension size,
--   error ORA-13470 is raised.
--   If the mask is not NULL or invalid, any exisiting bitmap mask associated 
--   with the given layer is replaced with the new one.
--

PROCEDURE setBitmapMask
(
   georaster   IN OUT MDSYS.SDO_GEORASTER, 
   layerNumber IN     NUMBER,
   mask        IN     MDSYS.SDO_GEORASTER, 
   NODATAMask  IN     VARCHAR2 DEFAULT NULL
);

-- 
-- NAME:
--   getBitmapMask
-- 
-- DESCRIPTION
--   Retrieve a bitmap mask as a standalone GeoRaster object
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--   storageParam - the storage parameter for the output GeoRaster object
--   mask         - the result GeoRaster object
--
-- NOTES 
--   If the source GeoRaster object is NULL or there is no bitmap mask
--   associated with the given layer, a NULL GeoRaster object is returned.
--
PROCEDURE getBitmapMask
(
   georaster    IN     MDSYS.SDO_GEORASTER, 
   layerNumber  IN     NUMBER,
   storageParam IN     VARCHAR2, 
   mask         IN OUT MDSYS.SDO_GEORASTER
);

-- 
-- NAME:
--   getBitmapMaskValue
-- 
-- DESCRIPTION
--   Retrieve a cell value of a bitmap mask
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--   pyramidLevel - the pyramid level
--   rowNumber    - row number in cell space
--   colNumber    - column number in cell space
--   ptGeom       - a point geometry in either cell space
--                  or model space
-- RETURNS
--   Number
--
-- NOTES
--   If the source GeoRaster object is NULL or there is no bitmap mask 
--   associated with the specfied raster layer, NULL is returned.
--   If the point position is out of scope, ORA-13415 is raised.
--
FUNCTION getBitmapMaskValue
(
   georaster    IN    MDSYS.SDO_GEORASTER,
   layerNumber  IN    NUMBER,
   pyramidLevel IN    NUMBER,
   rowNumber    IN    NUMBER,
   colNumber    IN    NUMBER
) RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBitmapMaskValue
(
   georaster    IN    MDSYS.SDO_GEORASTER,
   layerNumber  IN    NUMBER,
   pyramidLevel IN    NUMBER,
   ptGeom       IN    MDSYS.SDO_GEOMETRY
) RETURN NUMBER DETERMINISTIC PARALLEL_ENABLE;

-- 
-- NAME:
--   getBitmapMaskValues
-- 
-- DESCRIPTION
--   Retrieve one or more cell values of a bitmap mask
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--   pyramidLevel - the pyramid level
--   rowNumbers   - row numbers in cell space
--   colNumbers   - column numbers in cell space
--   ptGeom       - a multipoint geometry in either cell space
--                  or model space
-- RETURNS
--   MDSYS.SDO_NUMBER_ARRAY
--
--
FUNCTION getBitmapMaskValues
(
   georaster    IN    MDSYS.SDO_GEORASTER,
   layerNumber  IN    NUMBER,
   pyramidLevel IN    NUMBER,
   rowNumbers   IN    MDSYS.SDO_NUMBER_ARRAY,
   colNumbers   IN    MDSYS.SDO_NUMBER_ARRAY
) RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

FUNCTION getBitmapMaskValues
(
   georaster    IN    MDSYS.SDO_GEORASTER,
   layerNumber  IN    NUMBER,
   pyramidLevel IN    NUMBER,
   ptGeom       IN    MDSYS.SDO_GEOMETRY
) RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

-- 
-- NAME:
--   getBitmapMaskSubset
-- 
-- DESCRIPTION
--   Retrieve a subset of a bitmap mask
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--   pyramidLevel - the pyramid level
--   window/inWindow - the area of interest
--   rasterBlob   - the BLOB holding the output
--   outWindow    - the actual output window
--   storageParam - storage parameters for the output
--
-- NOTES
--   If the source GeoRaster object is NULL or there is no bitmap mask 
--   associated with the specfied raster layer, the result BLOB is empty.
--   If not specified, the storageParm for the output follows that of
--   the source GeoRaster object.
--
PROCEDURE getBitmapMaskSubset
(  
   georaster      IN     MDSYS.SDO_GEORASTER,
   layerNumber    IN     NUMBER,
   pyramidLevel   IN     NUMBER,
   window         IN     MDSYS.SDO_NUMBER_ARRAY,
   rasterBlob     IN OUT NOCOPY BLOB,
   storageParam   IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE getBitmapMaskSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   layerNumber    IN     NUMBER,
   pyramidLevel   IN     NUMBER,
   window         IN     MDSYS.SDO_GEOMETRY,
   rasterBlob     IN OUT NOCOPY BLOB,
   storageParam   IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE getBitmapMaskSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   layerNumber    IN     NUMBER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_NUMBER_ARRAY,
   rasterBlob     IN OUT NOCOPY BLOB,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL
);

PROCEDURE getBitmapMaskSubset
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   layerNumber    IN     NUMBER,
   pyramidLevel   IN     NUMBER,
   inWindow       IN     MDSYS.SDO_GEOMETRY,
   rasterBlob     IN OUT NOCOPY BLOB,
   outWindow      OUT    MDSYS.SDO_NUMBER_ARRAY,
   storageParam   IN     VARCHAR2 DEFAULT NULL
);

-- 
-- NAME:
--   hasBitmapMask
--
-- DESCRIPTION
--   Check whether a bitmap map exists for the specified GeoRaster layer
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--
-- RETURN
--   'NULL' if the GeoRaster object is NULL
--   'TRUE' if a bitmap mask exists
--   'FALSE' otherwise
--
FUNCTION hasBitmapMask
(
   georaster      IN     MDSYS.SDO_GEORASTER,
   layerNumber    IN     NUMBER
) RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

-- 
-- NAME:
--   hasNODATAMask
--
-- DESCRIPTION
--   Check whether a NODATA bitmap map exists for the specified GeoRaster layer
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--
-- RETURN
--   'NULL' if the GeoRaster object is NULL
--   'TRUE' if a bitmap mask exists and is a NODATA mask
--   'FALSE' otherwise
--
FUNCTION hasNODATAMask
(
    georaster     IN     MDSYS.SDO_GEORASTER,
    layerNumber   IN     NUMBER
) RETURN VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;

-- 
-- NAME:
--   setNODATAMask
--
-- DESCRIPTION
--   Specifies whether or not a bitmap mask on the specified GeoRaster layer
--   is NODATA mask. 
--
-- ARGUMENTS
--   georaster    - the source GeoRaster object
--   layerNumber  - an object layer (0) or a subLayer (>0)
--   isNODATAMask - 'TRUE' or 'FALSE'
--
-- RETURN
--   'NULL' if the GeoRaster object is NULL
--   'TRUE' if a bitmap mask exists and is a NODATA mask
--   'FALSE' otherwise
--
PROCEDURE setNODATAMask
(
    georaster     IN OUT MDSYS.SDO_GEORASTER,
    layerNumber   IN     NUMBER,
    isNODATAMask  IN     VARCHAR2
);


-- ---------------------------------------------------------------------
--           Validate GeoRaster Objects
-- ---------------------------------------------------------------------

--
-- NAME:
--      validateGeoRaster
--
-- DESCRIPTION
--      validate a GeoRaster object
--
-- ARGUMENTS
--      georaster    - The SDO_GEORASTER object to be validated
--
-- RETURNS
--      1. 'TRUE' if the georaster is valid
--      2. 'NULL' if the georaster object is null
--      3. A Oracle standard error code for known errors
--      4. 'FALSE' for unknown errors
--
FUNCTION validateGeoRaster
(
   georaster  IN MDSYS.SDO_GEORASTER
)
return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;


--
-- NAME:
--      schemaValidate
--
-- DESCRIPTION
--      Validate GeoRaster Metadata against the GeoRaster XML Schema
--      It explains the reasons if the metadata is not valid
--
-- ARGUMENTS
--      georaster - The SDO_GEORASTER object of which the metadata is 
--                  to be validated
--
-- RETURNS
--      1. 'TRUE' if the georaster is valid against XML schema
--      2. 'NULL' if the georaster or its metadata is null
--      3. Otherwise it prints Oracle standard error codes for 
--         detailed errors and stop directly
--
FUNCTION schemaValidate
(
   georaster  IN MDSYS.SDO_GEORASTER
)
return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;


-- ---------------------------------------------------------------------
-- import from and export to other raster sources/formats:
--   local FILE, HTTP file, ORDImage, BLOB, BFILE, GeoHeader files, etc 
-- ---------------------------------------------------------------------

--
-- NAME:
--      importFrom procedures
--
-- DESCRIPTION
--      import from FILE, HTTP into a GeoRaster object
--
-- ARGUMENTS
--      sourceFormat   - source format, such as JPEG, TIFF, etc.
--      sourceType     - FILE or HTTP, etc.
--      sourceName     - source file name with fullpath
--      storageParam   - the GeoRaster object storage formats
--      georaster      - original and result GeoRaster object
--                       It must be an existing GeoRaster object
--      r_sourceFormat - raster sourceFormat as above
--      r_sourceType   - raster sourceType as above
--      r_sourceName   - raster sourceName as above
--      r_sourceBlob   - Blob holding source image file
--      h_sourceFormat - geo-header sourceFormat as above
--      h_sourceType   - geo-header sourceType as above
--      h_sourceName   - geo-header sourceName as above
--      h_sourceClob   - Clob holding source geo-header file
--
-- RETURNS
--      sdo_georaster object
--

PROCEDURE importFrom
(
   georaster      IN OUT MDSYS.SDO_GEORASTER,
   storageParam   IN     VARCHAR2,
   r_sourceFormat IN     VARCHAR2,
   r_sourceType   IN     VARCHAR2,
   r_sourceName   IN     VARCHAR2,
   h_sourceFormat IN     VARCHAR2 default null,
   h_sourceType   IN     VARCHAR2 default null,
   h_sourceName   IN     VARCHAR2 default null
);

PROCEDURE importFrom
(
   georaster      IN OUT MDSYS.SDO_GEORASTER,
   storageParam   IN     VARCHAR2,
   r_sourceFormat IN     VARCHAR2,
   r_sourceBlob   IN     BLOB,
   h_sourceFormat IN     VARCHAR2 default null,
   h_sourceClob   IN     CLOB default null
);

--
-- NAME:
--      exportTo procedures
--
-- DESCRIPTION
--      export GeoRaster object to other types
--
-- ARGUMENTS
--      destFormat   - dest format, such as JPEG, TIFF, etc.
--      destType     - FILE, etc.
--      destName     - dest file name with fullpath
--      subsetParam  - subset/crop parameters for output a subset
--      georaster    - the GeoRaster object to be exported
--      r_destFormat - raster destFormat as above
--      r_destType   - raster destType as above
--      r_destName   - raster destName as above
--      r_destBlob   - Blob to hold the output image file
--      h_destFormat - geo-header destFormat as above
--      h_destType   - geo-header destType as above
--      h_destName   - geo-header destName as above
--      h_destClob   - Clob to hold the output geo-header file
--
-- RETURNS
--

PROCEDURE exportTo
(
   georaster      IN  MDSYS.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
);

PROCEDURE exportTo
(
   georaster      IN      MDSYS.SDO_GEORASTER,
   subsetParam    IN      VARCHAR2,
   destFormat     IN      VARCHAR2,
   destBlob       IN  OUT NOCOPY BLOB
);

PROCEDURE exportTo
(
   georaster      IN      MDSYS.SDO_GEORASTER,
   subsetParam    IN      VARCHAR2,
   r_destFormat   IN      VARCHAR2,
   r_destBlob     IN  OUT NOCOPY BLOB,
   h_destFormat   IN      VARCHAR2,
   h_destClob     IN  OUT NOCOPY CLOB
);

--
-- NAME:
--      getGeoreferenceType  function
--
-- DESCRIPTION
--      retrieve GeoReference type for the specified
--      GeoRaster object, so far, only three types are 
--      supported by this function as below, for all other 
--      types, UNKNOWN will return
--
--              1    --    Unknown
--              2    --    Affine Transform
--              3    --    Direct Linear Transform (DLT)  
--              4    --    Rational Polynomial Coefficient (RPC)
--
-- ARGUMENTS
--      georaster   - geoRaster object
--
-- RETURNS
--      an integer to represent GeoReference type 
FUNCTION getGeoreferenceType
(
  georaster    IN   MDSYS.SDO_GEORASTER
)
return number; 

--
-- NAME:
--      isLossless
--
-- DESCRIPTION
--      Returns a string value that indicates whether or not the GeoRaster 
--      object is compressed losslessly or lossily, or not compressed at all. 
--
-- ARGUMENTS
--      georaster - The SDO_GEORASTER object of which losslessness is to be 
--      determined.
--
-- RETURNS
--      1. 'TRUE' if GeoRaster object is losslessly compressed 
--      2. 'NULL' if the georaster or its metadata is null, or if the 
--         GeoRaster object is not compressed.
--      3. 'FALSE' if GeoRaster object is lossily compressed
--
FUNCTION isLossless
(
  geor    IN   MDSYS.SDO_GEORASTER
)
return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;


-- ---------------------------------------------------------------------
--    Reproject GeoRaster Objects
-- 
-- ---------------------------------------------------------------------

--
-- NAME:
--      reproject
--
-- DESCRIPTION
--      Re-project a geo-referenced GeoRaster object into a new projection
--      defined by SRID which is different from the current projection.
--
--      NOTE:
--         (1) The input GeoRaster object should have a supported projection;
--         (2) If not georeferenced, use setSRS to setup if the projection
--             was known;
--         (3) The new projection should be valid and different from current one.
--
-- ARGUMENTS
--      inGeoRaster    - The source SDO_GEORASTER object to be re-projected
--      pyramidLevel   - The pyramid level of the source GeoRaster object
--      cropArea       - The crop area to be re-projected. If it is of
--                     - SDO_GEOMETRY type, it can be in any coordinate space.
--                       If it is of SDO_NUMBER_ARRAY, it is in cell space only
--      layerNumbers   - The logical layers 
--      bandNumbers    - The physical bands in cell space
--      resampleParam  - The resampling method
--      storageParam   - A string specifying storage parameters for the result.
--                       The details of the parameters are explained in
--                       GeoRaster Manual
--      outSRID        - The SRID defines the new projection
--      outGeoRaster   - The re-projected persistent GeoRaster Object
--      rasterBlob     - The re-projected transient GeoRaster Object
--      outArea        - The re-projected transient GeoRaster Object extent
--                       in model coordinates.
--      outWindow      - The re-projected transient GeoRaster Object extent
--                       in cell coordinates.
--      bgValues       - background values for filling empty pixels
--                       one for each band
--
-- RETURNS
--      In the outGeoRaster is the re-projected GeoRaster object

-- For the persistent reprojection, the new GeoRatser is stored in table
PROCEDURE reproject (
     inGeoraster       IN MDSYS.SDO_GEORASTER,
     resampleParam     IN VARCHAR2,
     storageParam      IN VARCHAR2,
     outSRID           IN NUMBER,
     outGeoraster      IN OUT MDSYS.SDO_GEORASTER,
     bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE reproject (
     inGeoraster       IN MDSYS.SDO_GEORASTER,
     pyramidLevel      IN NUMBER,
     cropArea          IN MDSYS.SDO_GEOMETRY,
     layerNumbers      IN VARCHAR2,
     resampleParam     IN VARCHAR2,
     storageParam      IN VARCHAR2,
     outSRID           IN NUMBER,
     outGeoraster      IN OUT MDSYS.SDO_GEORASTER,
     bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE reproject (
     inGeoraster       IN MDSYS.SDO_GEORASTER,
     pyramidLevel      IN NUMBER,
     cropArea          IN MDSYS.SDO_NUMBER_ARRAY,
     bandNumbers       IN VARCHAR2,    
     resampleParam     IN VARCHAR2,
     storageParam      IN VARCHAR2,
     outSRID           IN NUMBER,
     outGeoraster      IN OUT MDSYS.SDO_GEORASTER,
     bgValues          IN MDSYS.SDO_NUMBER_ARRAY  DEFAULT NULL
);

-- For the transient reprojection (on the fly),
-- the new GeoRatser is stored as BLOB
PROCEDURE reproject (
     inGeoraster       IN MDSYS.SDO_GEORASTER,
     pyramidLevel      IN NUMBER,
     cropArea          IN MDSYS.SDO_GEOMETRY,
     layerNumbers      IN VARCHAR2,
     resampleParam     IN VARCHAR2,
     storageParam      IN VARCHAR2,
     outSRID           IN NUMBER,
     rasterBlob        IN OUT NOCOPY BLOB,
     outArea           OUT MDSYS.SDO_GEOMETRY,
     outWindow         OUT MDSYS.SDO_NUMBER_ARRAY,
     bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

PROCEDURE reproject (
     inGeoraster       IN MDSYS.SDO_GEORASTER,
     pyramidLevel      IN NUMBER,
     cropArea          IN MDSYS.SDO_NUMBER_ARRAY,
     bandNumbers       IN VARCHAR2,    
     resampleParam     IN VARCHAR2,
     storageParam      IN VARCHAR2,
     outSRID           IN NUMBER,
     rasterBlob        IN OUT NOCOPY BLOB,
     outArea           OUT MDSYS.SDO_GEOMETRY,
     outWindow         OUT MDSYS.SDO_NUMBER_ARRAY,
     bgValues          IN MDSYS.SDO_NUMBER_ARRAY  DEFAULT NULL
);


-- ---------------------------------------------------------------------
--    Georeference GeoRaster Using Control Points (GCPs)
-- 
-- ---------------------------------------------------------------------

--
-- NAME:
--      georeference
--
-- DESCRIPTION
--      This function will georeference an image using a set of
--      control points (GCPs).
--
-- ARGUMENTS
--
--      georaster      - The source SDO_GEORASTER object to be georeferenced
--      FFMethodType   - The (rational) polynomial function used as georeference model
--      nGCP           - Number of GCPs provided
--      GCPs           - The GCP collection. Each GCP represents a points pair, one on
--                       image and another in some coordinate system or another image.
--      gcpGeorefModel - A data structure contains FFMethodType, nGCP, GCPs,solutionAccuracy
--      storeGCP       - A flag indicate whether the GCPs should be stored in the georaster
--                       metadata.
--      SRID           - The GCP's model coordinates SRID
--      modelCoordLoc  - The location on cell for the corresponding model coords
--      setResolution  - whether to set the spatial resolution in the 
--                             SRS. "TRUE" or "FALSE" By default it is FALSE. 
--
-- RETURNS
--      The solution accuracy (rowRMS, colRMS, totalRMS) and the ground positionning
--      accuracy (xRMS, yRMS, (zRMS), totalModelRMS) if check points provided
--
Function georeference(
     inGeoraster      IN OUT MDSYS.SDO_GEORASTER,
     FFMethodType     IN VARCHAR2,
     nGCP             IN Number,
     GCPs             IN MDSYS.SDO_GEOR_GCP_COLLECTION,
     storeGCP         IN VARCHAR2 DEFAULT 'TRUE',
     SRID             IN Number DEFAULT NULL,
     modelCoordinateLocation  IN Number DEFAULT NULL,
     setResolution     IN VARCHAR2 DEFAULT NULL
)Return MDSYS.SDO_NUMBER_ARRAY;        -- RMSs


Function georeference(
    inGeoraster       IN OUT MDSYS.SDO_GEORASTER,
    gcpGeorefModel    IN MDSYS.SDO_GEOR_GCPGEOREFTYPE,
    storeGCP          IN VARCHAR2 DEFAULT 'TRUE',
    SRID              IN Number DEFAULT NULL,
    modelCoordinateLocation  IN Number DEFAULT NULL,
    setResolution     IN VARCHAR2 DEFAULT NULL
)Return MDSYS.SDO_NUMBER_ARRAY;        -- RMSs

-- For this function, the GCPs should be already stored in the metadata
-- 
Function georeference(
    inGeoraster      IN OUT MDSYS.SDO_GEORASTER,
    FFMethod         IN VARCHAR2 DEFAULT NULL,
    SRID              IN Number DEFAULT NULL,
    modelCoordinateLocation  IN Number DEFAULT NULL,
    setResolution     IN VARCHAR2 DEFAULT NULL
)Return MDSYS.SDO_NUMBER_ARRAY;        -- RMSs

--
-- Georeference XML data manipulation functions
--
Function getGCPGeorefModel(
    inGeoraster       IN MDSYS.SDO_GEORASTER
)Return MDSYS.SDO_GEOR_GCPGEOREFTYPE;

PROCEDURE setGCPGeorefModel(
    inGeoraster       IN OUT MDSYS.SDO_GEORASTER,
    gcpGeorefModel    IN MDSYS.SDO_GEOR_GCPGEOREFTYPE
);


Function getGCPGeorefMethod(
    inGeoraster       IN MDSYS.SDO_GEORASTER
)Return VARCHAR2 DETERMINISTIC PARALLEL_ENABLE;


PROCEDURE setGCPGeorefMethod(
    inGeoraster       IN OUT MDSYS.SDO_GEORASTER,
    georefMethod          IN VARCHAR2
);

Function getControlPoint(
    inGeoraster       IN MDSYS.SDO_GEORASTER,
    controlPointID    IN VARCHAR2
)Return MDSYS.SDO_GEOR_GCP DETERMINISTIC PARALLEL_ENABLE;

PROCEDURE setControlPoint(
    inGeoraster       IN OUT MDSYS.SDO_GEORASTER,
    controlPoint      IN MDSYS.SDO_GEOR_GCP
);

PROCEDURE deleteControlPoint(
    inGeoraster       IN OUT MDSYS.SDO_GEORASTER,
    controlPointID    IN VARCHAR2
);


-- ---------------------------------------------------------------------
--    Rectify GeoRaster Objects
--
-- ---------------------------------------------------------------------

--
-- NAME:
--      rectify
--
-- DESCRIPTION
--      Rectify a geo-referenced GeoRaster object.
--
--      NOTE:
--         (1) The input GeoRaster object should be referenced
--         (2) Use average elevation height or dem georaster (Ortho-Rectify)
--
-- ARGUMENTS
--
-- Input:
--      inGeoRaster      - Source SDO_GEORASTER object to be re-projected
--      pyramidLevel     - The pyramid level of the source GeoRaster object
--      elevationParam   - Average elevation height of the surface
--      dem              - Digital elevation model for ortho-rectification
--
-- Request:
--      outSRID          - The SRID defines the new projection
--      outModelCoordLoc - Specify the output cell coordinate system type,
--                          0 for CENTER or 1 for UPPERLEFT.
--      cropArea         - The crop area of the output image to be rectified
--      polygonClip      - Whether to do polygon clipping. If NULL, defaults
--                         to FALSE.
--      layerNumbers     - The logical layers to be processed
--      outResolutions   - Resolution(s) of each dimension of the output image
--      resolutionUnit   - Unit of the resolution
--      referencePoint   - The reference point to alligned the output image.
--                         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 projected output extent.
--                         This reference point must be in a SDO_GEOMETRY that
--                         describes a point.
--      resampleParam    - The resampling method
--
-- Output:
--      storageParam     - A string specifying storage parameters for the result.
--      outGeoRaster     - Re-projected persistent GeoRaster Object
--      rasterBlob       - The re-projected transient GeoRaster Object
--      outArea          - The re-projected transient GeoRaster Object extent
--                         in model coordinates.
--      outWindow        - The re-projected transient GeoRaster Object extent
--                         in cell coordinates.
--      bgValues         - Background values for filling empty pixels
--                         one for each band
--      parallelParam    - Degree of parallelism, "parallel=n"
--      generateMask     - Automaticaly generate Mask for cases where nodata
--                         connot be used (cellDepth=8BIT_U) or when user
--                         wants to force it to generate Mask.
--
-- RETURNS
--      For persistent output the outGeoRaster is the rectified GeoRaster object
--      For transient output the rasterBlob is the rectified resulted image and
--      outArea and outWindow specify the transient rasterBlob information

PROCEDURE rectify (
    -- input
    inGeoRaster       IN MDSYS.SDO_GEORASTER,
    pyramidLevel      IN NUMBER,
    elevationParam    IN VARCHAR2,
    dem               IN MDSYS.SDO_GEORASTER,
    -- request
    outSRID           IN NUMBER,
    outModelCoordLoc  IN NUMBER,
    cropArea          IN MDSYS.SDO_GEOMETRY,
    polygonClip       IN VARCHAR2,
    layerNumbers      IN VARCHAR2,
    outResolutions    IN MDSYS.SDO_NUMBER_ARRAY,
    resolutionUnit    IN VARCHAR2,
    referencePoint    IN MDSYS.SDO_GEOMETRY,
    resampleParam     IN VARCHAR2,
    -- output (georaster)
    storageParam      IN VARCHAR2,
    outGeoRaster      IN OUT MDSYS.SDO_GEORASTER,
    bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    -- parallel
    parallelParam     IN VARCHAR2 DEFAULT NULL,
    -- extra
    generateMask      IN VARCHAR2 DEFAULT NULL
);

PROCEDURE rectify (
    -- input
    inGeoRaster       IN MDSYS.SDO_GEORASTER,
    pyramidLevel      IN NUMBER,
    elevationParam    IN VARCHAR2,
    dem               IN MDSYS.SDO_GEORASTER,
    -- request
    outSRID           IN NUMBER,
    outModelCoordLoc  IN NUMBER,
    cropArea          IN MDSYS.SDO_GEOMETRY,
    polygonClip       IN VARCHAR2,
    layerNumbers      IN VARCHAR2,
    outResolutions    IN MDSYS.SDO_NUMBER_ARRAY,
    resolutionUnit    IN VARCHAR2,
    referencePoint    IN MDSYS.SDO_GEOMETRY,
    resampleParam     IN VARCHAR2,
    -- output (blob)
    storageParam      IN VARCHAR2,
    rasterBlob        IN OUT NOCOPY BLOB,
    outArea           OUT MDSYS.SDO_GEOMETRY,
    outWindow         OUT MDSYS.SDO_NUMBER_ARRAY,
    bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);


-- ---------------------------------------------------------------------
--    Apply AffineTransform on GeoRaster Objects
--
-- ---------------------------------------------------------------------

--
-- NAME:
--      AffineTransform
--
-- DESCRIPTION
--      Apply affine trasnformation on GeoRaster Objects
--
--      NOTE:
--
-- ARGUMENTS
--
-- Input:
--      inGeoRaster      - Source SDO_GEORASTER object to be transformed
--
-- Request:
--      translation      - An array of numbers contains the shift in x and y
--                         directions. If it is NULL, no translation happens.
--      scales           - An array of numbers contains the multiplication
--                         factors of image row and column. The first number
--                         is for column, and the second for row. If any one
--                         is NULL, no scale for that dimension; if the
--                         parameter is NULL, no scale applies.
--      rotatePoint      - Defines the point (X,Y) about which to rotate; if new
--                         use the default point (0,0).
--      rotateAngle      - The angle to rotate. If is NULL no rotation applies.
--      shear            - Array of numbers contains the shearing in x and y
--                         directions. The first number is X axis, and the
--                         second for Y axis. If any one is NULL, no shearing
--                         for that dimension; if the parameter is NULL, no
--                         shearing applies.
--      reflection       - Defines the axis about which the image is reflected,
--                         1 represent X axis, and 2 for Y axis. If it is NULL,
--                         no reflection applies.
--
-- Output:
--      storageParam     - A string specifying storage parameters for the result.
--      outGeoRaster     - Re-projected persistent GeoRaster Object
--      rasterBlob       - The re-projected transient GeoRaster Object
--      outArea          - The re-projected transient GeoRaster Object extent
--                         in model coordinates.
--      outWindow        - The re-projected transient GeoRaster Object extent
--                         in cell coordinates.
--      bgValues         - Background values for filling empty pixels
--                         one for each band
--      parallelParam    - Degree of parallelism, "parallel=n"
--
-- RETURNS
--      For persistent output the outGeoRaster is the rectified GeoRaster object
--      For transient output the rasterBlob is the rectified resulted image and
--      outArea and outWindow specify the transient rasterBlob information

PROCEDURE affineTransform (
    -- input
    inGeoRaster       IN MDSYS.SDO_GEORASTER,
    -- request
    translation       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    scales            IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    rotatePt          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    rotateAngle       IN NUMBER DEFAULT NULL,
    shear             IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    reflection        IN NUMBER DEFAULT NULL,
    -- output (georaster)
    storageParam      IN VARCHAR2,
    outGeoRaster      IN OUT MDSYS.SDO_GEORASTER,
    bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    -- parallel
    parallelParam     IN VARCHAR2 DEFAULT NULL
);

PROCEDURE AffineTransform (
    -- input
    inGeoRaster       IN MDSYS.SDO_GEORASTER,
    -- request
    translation       IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    scales            IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    rotatePt          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    rotateAngle       IN NUMBER DEFAULT NULL,
    shear             IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
    reflection        IN NUMBER DEFAULT NULL,
    -- output (blob)
    storageParam      IN VARCHAR2,
    rasterBlob        IN OUT NOCOPY BLOB,
    outArea           OUT MDSYS.SDO_GEOMETRY,
    outWindow         OUT MDSYS.SDO_NUMBER_ARRAY,
    bgValues          IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL
);

--
-- NAME:
--      generateSpatialResolutions
--
-- DESCRIPTION
--      Generate the spatial resolutions and set it to the georaster metadata 
--
--      NOTE: The input GeoRaster object should be referenced otherwise null
--            is returned.
--
-- PARAMETERS:
--      geoRaster        - Source SDO_GEORASTER object 
--      outResolution    - Output resolution in SDO_NUMBER_ARRAY for pyramid
--                         level 0 and in given georaster's SRID and unit. 
--

PROCEDURE generateSpatialResolutions(
    geoRaster         IN OUT MDSYS.SDO_GEORASTER, 
    outResolution     OUT MDSYS.SDO_NUMBER_ARRAY);

--
-- NAME:
--      generateSpatialResolutions
--
-- DESCRIPTION
--      Generate the spatial resolutions 
--
--      NOTE: The input GeoRaster object should be referenced otherwise null
--            is returned.
--
-- PARAMETERS:
--      geoRaster        - Source SDO_GEORASTER object 
--      pyramidLevel     - The pyramid level of the returned resolution, 
--                         default to the pyramid level 0.  
--      SRID             - The SRID for the returned resolution, default to the 
--                         given georaster's SRID. 
--      resolutionUnit   - The unit of the returned resolution. default to the 
--                         unit of the SRID.  
--
-- RETURN:
--      Resolution in SDO_NUMBER_ARRAY for the given georaster.
--
FUNCTION generateSpatialResolutions(
    geoRaster         IN MDSYS.SDO_GEORASTER,
    pyramidLevel      IN NUMBER DEFAULT NULL,
    SRID              IN NUMBER DEFAULT NULL, 
    resolutionUnit    IN VARCHAR2 DEFAULT NULL)
RETURN MDSYS.SDO_NUMBER_ARRAY PARALLEL_ENABLE;

--
-- NAME:
--      compressJP2
--
-- DESCRIPTION
--      Compress the GeoRaster image into one JP2 file in a GeoRaster object. 
--
-- PARAMETERS:
--      inGeoRaster        - Source SDO_GEORASTER object 
--      compressParam      - The compression parameter for the JPEG2000 
--                           compression:
--                             ratio = (r1, r2, r3, ..), r1, r2, r3 are the 
--                           compress ratio for the layer 1, 2, 3 of the JP2 
--                           code stream. It should be in decreasing order. 
--                           for example: ratio=(30, 20, 10)
--                           Bye default, the compression is lossless. This
--                           parameter cannot be specified together with 
--                           the psnr parameter. 
--                             psnr = (p1, p2, p3, ..), p1, p2, p3 are the 
--                           compression PSNR for the layer 1, 2, 3 of the JP2
--                           code stream. It should be in increasing order.
--                           for example: psnr=(30, 40, 50). By default, 
--                           the compression is lossless. This parameter
--                           cannot be specified together with ratio parameter.
--                             rlevel = n, n is the number of decompsition
--                           of the wavelet transform, thus the number of
--                           pyramids of the image. By default, the level of
--                           decomposition is floor(log2(tileSize)). 
--                             codeBlockSize=(cbrow, cbcol), where cbrow and
--                           cbcol are the size of the code block in row and
--                           column respectively. It must be in the range of
--                           [4, 1024] and cbrow * cbcol <= 4096. By default
--                           it is 64 x 64. 
--                             precinctSize=(pcrow, pccol), where pcrow and
--                           pccol are the size of the precinct in row and 
--                           column respectively. By default it is 256 x 256 
--                           on each resolution. 
--                             tileSize=(trow, rcol), where trow and tcol are
--                           the size of the tile in row and column 
--                           respectively. If the tilesize is greater than
--                           the image size, no tiling is applied. By default,
--                           there is no tiling. 
--                             dwt= reversible | irreversible, reversible means
--                           DWT 5-3, irreversible means DWT9-7 is used. 
--                             mct= true | false, indicate whether to use 
--                           Multiple Component Transform. By default, 
--                           RGB->YCC conversion is used if there are 3 
--                           bands or more. 
--                             progressOrder = LRCP|RLCP|RPCL|PCRL|CPRL, 
--                           By default, LRCP. 
--      outGeoRaster       - Target SDO_GEORASTER object 
--
--
PROCEDURE  compressJP2(
               inGeoRaster     IN MDSYS.SDO_GEORASTER,
               compressParam   IN VARCHAR2,
               outGeoRaster    IN OUT MDSYS.SDO_GEORASTER);
--
-- NAME:
--      decompressJP2
--
-- DESCRIPTION
--      Decompress the JP2 compressed GeoRaster image into a GeoRaster object. 
--
-- PARAMETERS:
--      inGeoRaster        - Source SDO_GEORASTER object 
--      pyramidLevel       - the pyrmaid level of the image
--      cropArea           - the area of the image to be decoded. 
--      bandNumbers        - the bands to be decoded. 
--      storageParam       - the storage parameter for the output GeoRaster
--                           object. 
--      outGeoRaster       - Target SDO_GEORASTER object 
--
--
PROCEDURE  decompressJP2(
               inGeoRaster     IN MDSYS.SDO_GEORASTER,
               pyramidLevel    IN NUMBER, 
               cropArea        IN MDSYS.SDO_NUMBER_ARRAY,
               bandNumbers     IN VARCHAR2,
               storageParam    IN VARCHAR2,
               outGeoRaster    IN OUT MDSYS.SDO_GEORASTER);
--
-- NAME:
--      decompressJP2
--
-- DESCRIPTION
--      Decompress the JP2 compressed GeoRaster image into a GeoRaster object. 
--
-- PARAMETERS:
--      inGeoRaster        - Source SDO_GEORASTER object 
--      pyramidLevel       - the pyrmaid level of the image
--      cropArea           - the area of the image to be decoded. 
--      layerNumbers       - the bands to be decoded. 
--      storageParam       - the storage parameter for the output GeoRaster
--                           object. 
--      outGeoRaster       - Target SDO_GEORASTER object 
--      bgValues           - background values for filling sparse data
--      polygonClip        - polygon clipping option 
--
--
PROCEDURE  decompressJP2(
               inGeoRaster     IN MDSYS.SDO_GEORASTER,
               pyramidLevel    IN NUMBER, 
               cropArea        IN MDSYS.SDO_GEOMETRY,
               layerNumbers    IN VARCHAR2,
               storageParam    IN VARCHAR2,
               outGeoRaster    IN OUT MDSYS.SDO_GEORASTER, 
               bgValues        IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
               polygonClip     IN VARCHAR2 DEFAULT NULL);

-- NAME:
--      warp
--
-- DESCRIPTION
--      Perform geometric transformation based on requested SRS
--
-- PARAMETERS:
--      inGeoRaster      - Source SDO_GEORASTER object 
--      pyramidLevel     - The pyramid level of the source GeoRaster object
--      outSRS           - Requestes output spatial reference system
--      cropArea         - The crop area of the output image image
--      dimensionSize    - The cell space dimension of the output image (rows, columns)
--      layerNumbers     - The logical layers to be processed
--      elevationParam   - Average elevation height of the surface
--      resampleParam    - Resample parameters for the result
--      storageParam     - Storage parameters for the result
--      outGeoRaster     - Target SDO_GEORASTER object 
--      rasterBlob       - The re-projected transient GeoRaster Object
--      outArea          - The re-projected transient GeoRaster Object extent
--                         in model coordinates.
--      outWindow        - The re-projected transient GeoRaster Object extent
--                         in cell coordinates.
--      bgValues         - Background values for filling empty pixels
--                         one for each band
--      parallelParam    - Degree of parallelism, "parallel=n"
--
PROCEDURE  warp(
               inGeoRaster     IN MDSYS.SDO_GEORASTER,
               pyramidLevel    IN NUMBER,
               outSRS          IN MDSYS.SDO_GEOR_SRS,
               cropArea        IN MDSYS.SDO_GEOMETRY,
               dimensionSize   IN MDSYS.SDO_NUMBER_ARRAY,
               layerNumbers    IN VARCHAR2,
               elevationParam  IN VARCHAR2,
               resampleParam   IN VARCHAR2,
               storageParam    IN VARCHAR2,
               outGeoRaster    IN OUT MDSYS.SDO_GEORASTER,
               bgValues        IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL,
               parallelParam   IN VARCHAR2 DEFAULT NULL);
--
PROCEDURE  warp(
               inGeoRaster     IN MDSYS.SDO_GEORASTER,
               pyramidLevel    IN NUMBER,
               outSRS          IN MDSYS.SDO_GEOR_SRS,
               cropArea        IN MDSYS.SDO_GEOMETRY,
               dimensionSize   IN MDSYS.SDO_NUMBER_ARRAY,
               layerNumbers    IN VARCHAR2,
               elevationParam  IN VARCHAR2,
               resampleParam   IN VARCHAR2,
               storageParam    IN VARCHAR2,
               rasterBlob      IN OUT NOCOPY BLOB,
               outArea         OUT MDSYS.SDO_GEOMETRY,
               outWindow       OUT MDSYS.SDO_NUMBER_ARRAY,
               bgValues        IN MDSYS.SDO_NUMBER_ARRAY DEFAULT NULL);

--
--
-- NAME:
--      getJP2TileSize
--
-- DESCRIPTION
--      Return the number of cells in row and column in a JP2 tile. 
-- If the georaster is not compressed in JP2-F format, an error is raised.
-- If the compressed JP2 data is not tiled, null is returned
--
-- PARAMETERS:
--      geoRaster    - the input GeoRaster object
--
FUNCTION getJP2TileSize(
               geoRaster      IN MDSYS.SDO_GEORASTER)
         RETURN MDSYS.SDO_NUMBER_ARRAY DETERMINISTIC PARALLEL_ENABLE;

END SDO_GEOR;
/

show errors;

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


OHA YOOOO