GeoRaster --- Oracle Spatial GeoRaster

# Oracle Spatial GeoRaster

This driver supports reading and writing raster data in Oracle Spatial GeoRaster format (10g or later). The Oracle Spatial GeoRaster driver is optionally built as a GDAL plugin, but it requires Oracle client libraries.

When opening a GeoRaster, it's name should be specified in the form:

georaster:<user>{,/}<pwd>{,@}[db],[table],[column],[where]
georaster:<user>{,/}<pwd>{,@}[db],<rdt>,<rid>

Where:

user = Oracle server user's name login
pwd = user password
db = Oracle server identification (database name)
table = name of a GeoRaster table (table that contains GeoRaster columns)
column = name of a column data type MDSYS.SDO_GEORASTER
where = a simple where clause to identify one or multiples GeoRaster
rdt = name of a raster data table
rid = numeric identification of one GeoRaster

Examples:

geor:scott,tiger,demodb,table,column,id=1
geor:scott,tiger,demodb,table,column,"id = 1"
"georaster:scott/tiger@demodb,table,column,gain>10"
"georaster:scott/tiger@demodb,table,column,city='Brasilia'"
georaster:scott,tiger,,rdt_10$,10
geor:scott/tiger,,rdt_10$,10

Note: do note use space around the field values and the commas.

### Browsing the database for GeoRasters

By providing some basic information the GeoRaster driver is capable of listing the existing rasters stored on the server:

To list all the GeoRaster table on the server that belongs to that user name and database:

% gdalinfo georasters:scott/tiger@db1

To list all the GeoRaster type columns that exist in that table:
% gdalinfo georasters:scott/tiger@db1,table_name

That will list all the GeoRaster objects stored in that table.

% gdalinfo georasters:scott/tiger@db1,table_name,georaster_column

That will list all the GeoRaster existing on that table according to a Where clause.

% gdalinfo georasters:scott/tiger@db1,table_name,georaster_column,city='Brasilia'
Note that the result of those queries are returned as GDAL metadata sub-datasets, e.g.:

% gdalinfo georaster:scott/tiger
Driver: GeoRaster/Oracle Spatial GeoRaster
Subdatasets:
SUBDATASET_1_NAME=georaster:scott,tiger,,LANDSAT
SUBDATASET_1_DESC=Table:LANDSAT
SUBDATASET_2_NAME=georaster:scott,tiger,,GDAL_IMPORT
SUBDATASET_2_DESC=Table:GDAL_IMPORT

### Creation Options

- BLOCKXSIZE: The number of pixel columns on raster block.
- BLOCKYSIZE: The number of pixel rows on raster block.
- BLOCKBSIZE: The number of bands on raster block.
- SRID: Assign a specific EPSG projection/reference system identification to the GeoRaster.
- INTERLEAVE: Band interleaving mode, BAND, LINE, PIXEL (or BSQ, BIP, BIL) for band sequential, Line or Pixel interleaving.
- DESCRIPTION: A simple description of a newly created table in SQL syntax. If the table already exist, this create option will be ignored, e.g.:

% gdal_translate -of georaster landsat_823.tif geor:scott/tiger@orcl,landsat,raster \
-co DESCRIPTION="(ID NUMBER, NAME VARCHAR2(40), RASTER MDSYS.SDO_GEORASTER)" \
-co INSERT="VALUES (1,'Scene 823',SDO_GEOR.INIT())"

- INSERT: A simple SQL insert/values clause to inform the driver what values to fill up when inserting a new row on the table, e.g.:

% gdal_translate -of georaster landsat_825.tif geor:scott/tiger@orcl,landsat,raster \
-co INSERT="ID, RASTER VALUES (2,SDO_GEOR.INIT())"

- COMPRESS: Compression options, JPEG-F, JPEG-B, DEFLATE or NONE. The two JPEG options are lossy, meaning that the original pixel values are changed. The JPEG-F store a full JPEG structure on each block while JPEG-B are smaller since they don't store Huffman and Quantization tables.
- QUALITY: Quality compression option for JPEG ranging from 0 to 100. The default is 75.
- NBITS: Sub byte data type, options: 1, 2 or 4.

### Importing GeoRaster

During the process of importing raster into a GeoRaster object it is possible to give the driver a simple SQL table definition and also a SQL insert/values clause to inform the driver about the table to be created and the values to be added to the newly created row. The following example does that:

% gdal_translate -of georaster landsat_1.tif georaster:scott/tiger,,landsat,scene \
-co "DESCRIPTION=(ID NUMBER, SITE VARCHAR2(45), SCENE MDSYS.SDO_GEORASTER)" \
-co "INSERT=VALUES(1,'West fields', SDO_GEOR.INIT())"

Note that the create option DESCRIPTION requires to inform table name (in bold). And column name (underlined) should match the description:

% gdal_translate -of georaster landsat_1.tif georaster:scott/tiger,,landsat,scene \
-co "DESCRIPTION=(ID NUMBER, SITE VARCHAR2(45), SCENE MDSYS.SDO_GEORASTER)" \
-co "INSERT=VALUES(1,'West fields', SDO_GEOR.INIT())"

If the table "landsat" exist, the option "DESCRIPTION" is ignored. The driver can only update one GeoRaster column per run of gdal_translate. Oracle create default names and values for RDT and RID during the initialization of the SDO_GEORASTER object but user are also able to specify a name and value of their choice.

% gdal_translate -of georaster landsat_1.tif georaster:scott/tiger,,landsat,scene \
-co "INSERT=VALUES(10,'Main building', SDO_GEOR.INIT("RDT", 10))"

If no information is given about where to store the raster the driver will create (if doesn't exist already) a default table named GDAL_IMPORT with just one GeoRaster column named RASTER, example:

% gdal_translate -of georaster input.tif “geor:scott/tiger@dbdemo”

### Exporting GeoRaster

A GeoRaster can be identified by a Where clause or by a pair of RDT & RID:
% gdal_translate -of gtiff geor:scott/tiger@dbdemo,landsat,scene,id=54 output.tif
% gdal_translate -of gtiff geor:scott/tiger@dbdemo,st_rdt_1,130 output.tif

### General use of GeoRaster

GeoRaster can be used in any GDAL command line tool with all the available options. Like a image subset extraction of re-project:
% gdal_translate -of gtiff geor:scott/tiger@dbdemo,landsat,scene,id=54 output.tif \
-srcwin 0 0 800 600
% gdalwarp -of png geor:scott/tiger@dbdemo,st_rdt_1,130 output.png -t_srs EPSG:9000913
Two different GeoRaster can be used as input and output on the same operation:
% gdal_translate -of georaster geor:scott/tiger@dbdemo,landsat,scene,id=54 geor:scott/tiger@proj1,projview,image -co INSERT="VALUES (102, SDO_GEOR.INIT())"
Applications that use GDAL can theoretically read and write from GeoRaster just like any other format but most of then are more inclined to try to access files on the file system so one alternative is to create VRT to represent the GeoRaster description, e.g.:
% gdal_translate -of VRT geor:scott/tiger@dbdemo,landsat,scene,id=54 view_54.vrt
% openenv view_54.vrt

###