Rem Rem $Header: sdogrxml.sql 18-jun-2008.10:52:32 hzhu Exp $ Rem Rem sdogrxml.sql Rem Rem Copyright (c) 2002, 2008, Oracle. All rights reserved. Rem Rem NAME Rem sdogrxml.sql - System table for supported formats Rem - XML Schema for SDO_GEORASTER metadata Rem - supported formats and their metadata XML schemas Rem Rem DESCRIPTION Rem Defines the system table for GeoRaster and supported formats Rem XML Schema for SDO_GEORASTER which defines SDO_GEORASTER.metadata Rem Lists supported formats and the XML schemas for their SDO_GRMETADATAs Rem Rem NOTES Rem Rem Rem MODIFIED (MM/DD/YY) Rem hzhu 05/21/08 - Add GCP georeference support Rem syuditsk 03/06/06 - adding georaster JPEG2000 support Rem syuditsk 01/29/06 - removing sdogr.jar load Rem wexu 01/04/06 - support multiple nodata values/value ranges Rem bgouslin 09/26/05 - Load Java from jlib now Rem qxie 02/03/05 - add LizardTech wavelet compression types Rem wexu 09/17/04 - overwrite existing schema text Rem sravada 07/30/04 - add create/replace Rem syuditsk 07/16/04 - adding JPEG-F compression format option Rem syuditsk 07/13/04 - removing JPEG-L Rem syuditsk 06/16/04 - adding compression quality to xml schema Rem wexu 05/07/04 - bug 3612776 Rem qxie 05/03/04 - add DEFLATE compression type Rem qxie 02/13/04 - add JPEG-L compression type Rem qxie 02/02/04 - add JPEG-B compression type Rem qxie 07/22/03 - no grant on demos Rem sravada 06/20/03 - move sdogr to sdogrxml.sql Rem qxie 04/18/03 - HEXHEDRON -> HEXAHEDRON Rem wexu 03/28/03 - remove grant privileges Rem qxie 12/03/02 - remove my name as author in schema Rem wexu 11/20/02 - grant privileges to MDSYS Rem qxie 10/14/02 - comments Rem qxie 10/07/02 - displayLUT becomes histogram, colormap, grayscale Rem qxie 09/27/02 - add AVERAGEs and change namespace Rem qxie 09/16/02 - re-order defaultRGB & row/col in rectangle Rem wexu 08/28/02 - layerInfo required Rem wexu 08/23/02 - misc changes Rem qxie 08/15/02 - fit into 10i and some editing Rem wexu 04/16/02 - register georasterMetadata schema Rem qxie 03/25/02 - updated xml schema Rem qxie 01/25/02 - GeoRaster format system table Rem XML Schema for SDO_GEORASTER.metadata Rem qxie 01/25/02 - Created Rem -- ---------------------------------------------------------------- -- system data table for GeoRaster supported formats -- and their corresponding metadata XML Schemas -- ---------------------------------------------------------------- -- DROP TABLE SDO_GEOR_XMLSCHEMA_TABLE; declare begin begin execute immediate 'CREATE TABLE SDO_GEOR_XMLSCHEMA_TABLE ( id NUMBER PRIMARY KEY, georasterFormat VARCHAR2(1024) UNIQUE, xmlSchema CLOB) '; exception when others then NULL; end; end; / GRANT SELECT ON SDO_GEOR_XMLSCHEMA_TABLE TO PUBLIC; -- ---------------------------------------------------------------- -- the pl/sql blocks to insert GeoRaster supported formats -- and their related Metadata XML Schemas -- ---------------------------------------------------------------- -- ---------------------------------------------------------------- -- Insert Oracle defined GeoRaster Metadata XML Schema -- NOTE: ID for SDO_GEORASTER format is 1, name is 'GEORASTER' -- ---------------------------------------------------------------- DECLARE schemaclob CLOB; amt NUMBER; buf VARCHAR2(32767); pos NUMBER; BEGIN DELETE FROM SDO_GEOR_XMLSCHEMA_TABLE WHERE id=1; INSERT INTO SDO_GEOR_XMLSCHEMA_TABLE VALUES (1, 'GEORASTER', empty_clob()) RETURNING xmlSchema into schemaclob; SELECT xmlSchema into schemaclob from SDO_GEOR_XMLSCHEMA_TABLE WHERE id = 1 FOR UPDATE; DBMS_LOB.OPEN(schemaclob, DBMS_LOB.LOB_READWRITE); buf := ' ==================================================== This is the XML Schema defining the metadata of Oracle GeoRaster object type It consists of two parts: data type definitions and its element content Part 1: Data Types Part 1.1: Data Types for Object Info Part 1.2: Data Types for Raster Info Part 1.3: Data Types for Spatial-Temporal-Band Reference Systems Part 1.3.1: Data Types for Raster Spatial Reference Systems Part 1.3.2: Data Types for Raster Temporal Reference Systems Part 1.3.3: Data Types for Raster Band Reference Systems Part 1.4: Data Types for Layer Metadata Part 2: GeoRaster Metadata Elements or Content Structure ============================================================= =============================================== Part 1: Data Types ================================================ ============================== Part 1.1: Data Types for Object Info ============================== ============================== Part 1.2: Data Types for Raster Info ============================== The "Band" dimension can be treated as any other semantic dimension or any "Layer" if not remote sensing imagery or photographs =========================================================== Part 1.3.1: Data Types for GeoRaster Spatial Reference System Spatial extent (footprint) is recorded as an attribute of georaster object. Its type is SDO_GEOMETRY. So it is not included in the metadata The cell space coordinates are named as (row, column, vertical) The model space coordinates are named as (x, y, z) Spatial unit information is stored in the WKT of the specified SRID ============================================================ The following "S" means "Spectral" for remote sensing imagery Any of X, Y and Z can be horizontal or vertical or any other spatial direction (depending on user interpretation in "modelDimensionDescription") row = pPolynomial(x, y, z) / qPolynomial(x, y, z) column = rPolynomial(x, y, z) / sPolynomial(x, y, z) The following types and definitions are for GCP support. It stores GCP collection for the GeoRaster object. It also optionally specify the Functional Fitting method for generating FFM using the GCP collection. cellDimension can 2 or 3 (only 2 is supported in current release). modelDimension can be 2, 3, -2, -3. cellCoordinate must be (row, column) in current release modelCoordinate must be (X, Y) or (X, Y, Z) in current release ================================================= Part 1.3.2: Data Types for GeoRaster Temporal Reference System The TRS will be modeled by formulas in the future ================================================= ================================================== Part 1.3.3: Data Types for GeoRaster Band Reference System For multispectral remote sensing images, each band is optionally described in the layerDescriptionType The BRS is modeled by formulas for hyperspectral imagery (based on number of spectral segments, min and max wavelength and number of bands for each segment) Detailed radiometric info will be added in the future ===================================================== ==================================================== Part 1.4: Data Types for Layer Metadata For each sub-layer the layerNumber is a positive integer, i.e., layers are logically numbered from 1 to n if the size of the specified layerDimension is n. The layerDimensionOrdinate of each sublayer must be in the range of the dimension and must be in the order of band ordinates. For objectLayer, the layerNumber should be 0 but its layerDimensionOrdinate is not used. ======================================================= value = (a0 + a1 * cellValue) / (b0 + b1 * cellValue) LINEAR bin function: binNumber = numbins * (cellValue - min) / (max - min) + firstBinNumber if (binNumber less than 0) binNumber = firstBinNumber if (binNumber greater than or equal to numbins) binNumber = numbins + firstBinNumber - 1 LOGARITHM bin function: binNumber = numbins * (ln (1.0 + ((cellValue - min)/(max - min)))/ ln (2.0)) + firstBinNumber if (binNumber less than 0) binNumber = firstBinNumber if (binNumber greater than or equal to numbins) binNumber = numbins + firstBinNumber - 1 EXPLICIT bin function means explicit (or direct) value (or value range) for each bin and it will be stored in a table The MAX and MIN in statistic dataset will be used if they are not provided here binTableName is used by EXPLICIT type only ======================================================= Part 2: Metadata Elements / Content Structure of Oracle GeoRaster Object ========================================================== '; amt := length(buf); pos := 1; DBMS_LOB.WRITE(schemaclob, amt, pos, buf); DBMS_LOB.CLOSE(schemaclob); COMMIT; END; / SHOW ERRORS; ----------------------------------------------------------------------------- -- register georasterMetadata schema ----------------------------------------------------------------------------- declare usr varchar2(30); url varchar2(200); loc clob; cnt number; begin usr := 'MDSYS'; url := 'http://xmlns.oracle.com/spatial/georaster/georaster.xsd'; -- First check whether the schema has been registered already. -- If it has, de-register it. This might cause an error to be raised if -- there are dependent tables or schemas. User then needs to manually -- remove/evolve the depdendent objects and run this script again. execute immediate 'SELECT count(*) FROM dba_xml_schemas WHERE owner=:1 AND schema_url=:2' into cnt using usr, url; if cnt <> 0 then dbms_xmlschema.deleteSchema(url, dbms_xmlschema.DELETE_CASCADE); end if; select xmlSchema into loc from SDO_GEOR_XMLSCHEMA_TABLE where georasterFormat='GEORASTER'; -- register the schema dbms_xmlschema.registerSchema(url, loc, FALSE, FALSE, FALSE, FALSE, FALSE, usr); end; /