[postgis-commits] svn - r2658 - in branches/gSoC2007_raster: .
pgraster
postgis-commits at postgis.refractions.net
postgis-commits at postgis.refractions.net
Sun Jul 15 13:02:40 PDT 2007
Author: xingkth
Date: 2007-07-15 13:02:39 -0700 (Sun, 15 Jul 2007)
New Revision: 2658
Added:
branches/gSoC2007_raster/pgraster/
branches/gSoC2007_raster/pgraster/pgraster_tables.sql
Log:
Xing Lin: Add Table definition for PGRASTER (GoogleSoC2007)
Added: branches/gSoC2007_raster/pgraster/pgraster_tables.sql
===================================================================
--- branches/gSoC2007_raster/pgraster/pgraster_tables.sql 2007-07-13 05:48:32 UTC (rev 2657)
+++ branches/gSoC2007_raster/pgraster/pgraster_tables.sql 2007-07-15 20:02:39 UTC (rev 2658)
@@ -0,0 +1,317 @@
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- $Id: PGRASTER_TABLES.sql 2007-07-15 Xing Lin $
+--
+-- PostGIS - Spatial Types for PostgreSQL
+-- http://postgis.refractions.net
+-- Copyright 2001-2003 Refractions Research Inc.
+--
+-- This is free software; you can redistribute and/or modify it under
+-- the terms of the GNU General Public Licence. See the COPYING file.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- INFORMATION ABOUT PGRASTER:
+--
+-- PGRaster is a component of PostGIS that handels the management of
+-- raster datasets in PostgreSQL/PostGIS spatial database. Currently,
+-- this extension is still under designing and development. You can
+-- download it from SVN site of PostGIS for a preview, or you can install
+-- it with PostGIS after it is publicly released.
+--
+-- PGRaster is also serviced as one of Gooogle SoC 2007 projects.
+--
+-- Any advices or bugs reports, please write to Xing at solo.lin at gmail.com
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--
+-- WARNING: Any change in this file must be evaluated for compatibility.
+-- Changes cleanly handled by lwpostgis_uptrade.sql are fine,
+-- other changes will require a bump in Major version.
+-- Currently only function replaceble by CREATE OR REPLACE
+-- are cleanly handled.
+--
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+-- ABOUT THIS FILE --
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+-- NAME: PGRASTER_TABLES.SQL
+-- AUTHOR: XING LIN
+-- CREATED_DATE: 2007-07-15
+-- LAST_UPDATED: 2007-07-15
+-- PURPORSE: This SQL file include the definition of the metadata table for
+-- PGRaster extension. You can use this file as an template to
+-- create your own metadata table for your raster database in
+-- PostgreSQL/PostGIS.
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+--DEFINITION OF TYPE INFORMATION
+-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+--BAND TYPE CODES & NAMES
+CREATE TABLE PGRASTER_TYPES_BANDTYPE
+(
+ typeID SMALLINT,
+ typeName TEXT,
+ descriptioin TEXT,
+ PRIMARY KEY (typeID)
+);
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(-1,'BT_UNKNOWN','Unknown Band Type');
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(0,'BT_SINGLE','Single Band Raster Dataset');
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(1,'BT_RGB','RGB Image Raster Dataset');
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(2,'BT_RGBA','RGBA Image Raster Dataset');
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(3,'BT_MULTI','Multi-bands Raster Dataset');
+INSERT INTO PGRASTER_TYPES_BANDTYPE VALUES(4,'BT_OTHERS','Other Image Raster Dataset');
+
+--DATA TYPE CODES & NAMES
+CREATE TABLE PGRASTER_TYPES_DATATYPE
+(
+ typeID SMALLINT,
+ typeName TEXT,
+ descriptioin TEXT,
+ PRIMARY KEY (typeID)
+);
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(-1,'DT_UNKNOWN','Unkown Data Type');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(0,'DT_1BIT','A Boolean Data Unit having A Cell Depth of 1 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(1,'DT_2BIT','2 Bits Unsigned Integer having A Cell Depth of 2 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(2,'DT_4BIT','4 Bits Unsigned Integer having A Cell Depth of 4 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(3,'DT_8BIT_U','8 Bits Unsigned Integer having A Cell Depth of 8 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(4,'DT_8BIT_S','8 Bits Signed Integer having A Cell Depth of 8 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(5,'DT_16BIT_U','16 Bits Unsigned Integer having A Cell Depth of 16 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(6,'DT_16BIT_S','16 Bits Signed Integer having A Cell Depth of 16 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(7,'DT_32BIT_U','32 Bits Unsigned Integer having A Cell Depth of 32 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(8,'DT_32BIT_S','32 Bits Signed Integer having A Cell Depth of 32 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(9,'DT_24BIT_RGB','24 Bits RGB data having A Cell Depth of 24 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(10,'DT_32BIT_RGBA','32 Bits RGBA data having A Cell Depth of 32 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(11,'DT_32BIT_REAL','32 Bits Real/Single Floating data having A Cell Depth of 32 Bits');
+INSERT INTO PGRASTER_TYPES_DATATYPE VALUES(12,'DT_64BIT_REAL','64 Bits Real/Double Floating data having A Cell Depth of 64 Bits');
+
+--VALUE TYPE CODES & NAMES
+CREATE TABLE PGRASTER_TYPES_VALUETYPE
+(
+ typeID SMALLINT,
+ typeName TEXT,
+ descriptioin TEXT,
+ PRIMARY KEY (typeID)
+);
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(-1, 'VT_UNKNOWN','Unknown Value Type');
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(0, 'VT_NOMINAL','Nominal Value Type');
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(1, 'VT_ORDINAL','Ordinal Value Type');
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(2, 'VT_INTERVAL','Interval Value Type');
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(3, 'VT_RATIO','Ratio Value Type');
+INSERT INTO PGRASTER_TYPES_VALUETYPE VALUES(4, 'VT_IMAGE','Image Value Type');
+
+--BANDINTERLEAVING CODES & NAMES
+CREATE TABLE PGRASTER_TYPES_BANDINTERLEAVINGTYPE
+(
+ typeID SMALLINT NOT NULL,
+ typeName TEXT NOT NULL,
+ descriptioin TEXT NOT NULL,
+ PRIMARY KEY (typeID)
+);
+INSERT INTO PGRASTER_TYPES_BANDINTERLEAVINGTYPE VALUES(-1, 'BI_UNKNOWN','Unknown Band Interleaving Type');
+INSERT INTO PGRASTER_TYPES_BANDINTERLEAVINGTYPE VALUES(0, 'BI_BSQ','BSQ Band Interleaving Type');
+INSERT INTO PGRASTER_TYPES_BANDINTERLEAVINGTYPE VALUES(1, 'BI_BIL','BIL Band Interleaving Type');
+INSERT INTO PGRASTER_TYPES_BANDINTERLEAVINGTYPE VALUES(2, 'BI_BIP','BIP Band Interleaving Type');
+
+--COMPRESSION CODES & NAMES
+CREATE TABLE PGRASTER_TYPES_COMPRESSIONTYPE
+(
+ typeID SMALLINT NOT NULL,
+ typeName TEXT NOT NULL,
+ descriptioin TEXT NOT NULL,
+ PRIMARY KEY (typeID)
+);
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(-1, 'CT_UNKNOWN','Unknown Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(0, 'CT_JPEG_B','JPEG-B Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(1, 'CT_JPEG_F','JPEG-F Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(2, 'CT_LZW','LZW/LZ77 Compression Type');
+INSERT INTO PGRASTER_TYPES_COMPRESSIONTYPE VALUES(3, 'CT_NONE','UNCOMPRESSION/PLAIN Compression Type');
+
+-- DEFINITION OF PGRASTER_METADATA
+
+CREATE TABLE PGRASTER_METADATA
+(
+ rasterObjectID BIGSERIAL PRIMARY KEY,
+ name TEXT NOT NULL,
+ captureDate DATE NOT NULL DEFAULT NOW(),
+ rasterDimensions SMALLINT NOT NULL DEFAULT 0,
+ rasterBandType SMALLINT NOT NULL DEFAULT -1 REFERENCES pgraster_types_bandtype (typeid),
+ rasterDataType SMALLINT NOT NULL DEFAULT -1 REFERENCES pgraster_types_datatype (typeid),
+ rasterValueType SMALLINT NOT NULL DEFAULT -1 REFERENCES pgraster_types_valuetype (typeid),
+ rasterDataTable TEXT NOT NULL DEFAULT 'PGRASTER_DATA',
+ rasterBandCount INTEGER NOT NULL DEFAULT 0,
+ rasterRowCount INTEGER NOT NULL DEFAULT 0,
+ rasterColumnCount INTEGER NOT NULL DEFAULT 0,
+ rasterCellDepth INTEGER NOT NULL DEFAULT 0,
+ rasterPyramidEnabled BOOLEAN NOT NULL DEFAULT TRUE,
+ rasterPyramidDepth INTEGER NOT NULL DEFAULT 0,
+ blockSizeBands INTEGER NOT NULL DEFAULT -1, -- (-1: means all bands included)
+ blockSizeRows INTEGER NOT NULL DEFAULT 256,
+ blockSizeColumns INTEGER NOT NULL DEFAULT 256,
+ blockPadding BOOLEAN NOT NULL DEFAULT TRUE,
+ blockBandInterleaving SMALLINT NOT NULL DEFAULT 0, -- (0: BSQ Band Interleaving Approach)
+ blockCompression SMALLINT NOT NULL DEFAULT 3 REFERENCES pgraster_types_compressiontype (typeid), -- (3: CT_LZW)
+ blockQuality INTEGER NOT NULL DEFAULT 100,
+ nodataValue NUMERIC NOT NULL DEFAULT -1,
+ SRID INTEGER NOT NULL DEFAULT -1, -- (-1: means no spatial reference attached)
+ geoReferenced BOOLEAN NOT NULL DEFAULT FALSE,
+ spatialExtent GEOMETRY DEFAULT NULL
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Foreign Key and Other Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+);
+
+
+--DEFINITION OF PGRASTER_DATA
+
+CREATE TABLE PGRASTER_DATA
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata (rasterObjectID),
+ pyramidLevel INTEGER NOT NULL DEFAULT -1,
+ bandBlockNumber INTEGER NOT NULL DEFAULT -1,
+ rowBlockNumber INTEGER NOT NULL DEFAULT -1,
+ columnBlockNumber INTEGER NOT NULL DEFAULT -1,
+ blockBandSize INTEGER NOT NULL DEFAULT -1, --(-1: means ALL bands included.)
+ blockRowSize INTEGER NOT NULL DEFAULT 256,
+ blockColumnSize INTEGER NOT NULL DEFAULT 256,
+ blockMBR GEOMETRY NOT NULL,
+ dataBlock BYTEA NOT NULL,
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID,pyramidLevel,bandBlockNumber,rowBlockNumber,columnBlockNumber)
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Foreign Key And Other Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+);
+
+-- CREATE GiST-R Tree index on PGRASTER_DATA (blockMBR)
+CREATE INDEX index_pgraster_data ON pgraster_data using GIST ( blockMBR GIST_GEOMETRY_OPS);
+
+--DEFINITION OF PGRASTER_SRS
+CREATE TABLE PGRASTER_SRS
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata (rasterObjectID),
+ isReferenced BOOLEAN NOT NULL DEFAULT FALSE,
+ isOrthoRectified BOOLEAN NOT NULL DEFAULT FALSE,
+ SRID INTEGER NOT NULL DEFAULT -1,
+ spatialResolutionX NUMERIC NOT NULL DEFAULT 0.0,
+ spatialResolutionY NUMERIC NOT NULL DEFAULT 0.0,
+ spatialResolutionZ NUMERIC NOT NULL DEFAULT 0.0,
+ spatialTolerance NUMERIC NOT NULL DEFAULT 0.0,
+ coordLocation SMALLINT NOT NULL DEFAULT 0,
+ rowOff NUMERIC NOT NULL DEFAULT 0,
+ columnOff NUMERIC NOT NULL DEFAULT 0,
+ heightOff NUMERIC NOT NULL DEFAULT 0,
+ xOff NUMERIC NOT NULL DEFAULT 0,
+ yOff NUMERIC NOT NULL DEFAULT 0,
+ zOff NUMERIC NOT NULL DEFAULT 0,
+ rowScale NUMERIC NOT NULL DEFAULT 1,
+ columnScale NUMERIC NOT NULL DEFAULT 1,
+ heightScale NUMERIC NOT NULL DEFAULT 1,
+ xScale NUMERIC NOT NULL DEFAULT 1,
+ yScale NUMERIC NOT NULL DEFAULT 1,
+ zScale NUMERIC NOT NULL DEFAULT 1,
+ columnRMS NUMERIC NOT NULL DEFAULT 0.0,
+ totalRMS NUMERIC NOT NULL DEFAULT 0.0,
+ -- parameters for afline transformation from cell coordinates systems to ground / local coordinates
+ rowNumberator NUMERIC[] DEFAULT NULL,
+ rowDenominator NUMERIC[] DEFAULT NULL,
+ columnNumerator NUMERIC[] DEFAULT NULL,
+ columnDenominator NUMERIC[] DEFAULT NULL,
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID)
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Foreign Key And Other Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+);
+
+--DEFINITION OF PGRASTER_GCPS
+CREATE TABLE PGRASTER_GCPS
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata (rasterObjectID),
+ gcpID BIGSERIAL,
+ cellColumn NUMERIC NOT NULL DEFAULT 0.0,
+ cellRow NUMERIC NOT NULL DEFAULT 0.0,
+ cellHeight NUMERIC NOT NULL DEFAULT 0.0,
+ groundX NUMERIC NOT NULL DEFAULT 0.0,
+ groundY NUMERIC NOT NULL DEFAULT 0.0,
+ groundZ NUMERIC NOT NULL DEFAULT 0.0,
+ rmsError NUMERIC NOT NULL DEFAULT 0.0,
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID,gcpID)
+);
+
+
+--DEFINITIOF OF PGRASTER_VATS
+CREATE TABLE PGRASTER_VATS
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata(rasterObjectID),
+ bandID INTEGER NOT NULL DEFAULT 0,
+ value NUMERIC NOT NULL,
+ attribute TEXT NOT NULL DEFAULT '',
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID,bandID,value)
+);
+
+--DEFINITION OF PGRASTER_STATITICS
+CREATE TABLE PGRASTER_STATISTICS
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata(rasterObjectID),
+ bandID INTEGER NOT NULL DEFAULT 0,
+ maxValue NUMERIC NOT NULL DEFAULT 0,
+ minValue NUMERIC NOT NULL DEFAULT 0,
+ avgValue NUMERIC NOT NULL DEFAULT 0,
+ modeValue NUMERIC NOT NULL DEFAULT 0,
+ stdValue NUMERIC NOT NULL DEFAULT 0,
+ lastUpdate TIMESTAMP DEFAULT NOW(),
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID,bandID)
+);
+
+--DEFINITION OF PGRASTER_HISTOGRAM
+CREATE TABLE PGRASTER_HISTOGRAM
+(
+ rasterObjectID INTEGER REFERENCES pgraster_metadata(rasterObjectID),
+ bandID INTEGER NOT NULL DEFAULT 0,
+ value NUMERIC NOT NULL DEFAULT 0,
+ count NUMERIC NOT NULL DEFAULT 0,
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Primary Key Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ PRIMARY KEY (rasterObjectID,bandID,value)
+);
+
+
+--DEFINITION OF PGRASTER_UTILITIES_PALETTE
+CREATE TABLE PGRASTER_UTILS_PALETTE
+(
+ id SERIAL,
+ name TEXT,
+ description TEXT,
+ colorNumber INTEGER,
+ colorDepth INTEGER, -- RGB=24, RGBA=32
+ colorData BYTEA,
+ PRIMARY KEY (id)
+
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ -- Foreign Key And Other Constraints should be added Here
+ -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+);
+
More information about the postgis-commits
mailing list