1 GeoRaster Overview and Concepts

GeoRaster is a feature of Oracle Spatial that lets you store, index, query, analyze, and deliver raster image and gridded data and its associated metadata. GeoRaster provides Oracle spatial data types and an object-relational schema. You can use these data types and schema objects to store multidimensional grid layers and digital images that can be referenced to positions on the Earth's surface or in a local coordinate system. If the data is georeferenced, you can find the location on Earth for a cell in an image; or given a location on Earth, you can find the cell in an image associated with that location.

GeoRaster can be used with data from any technology that captures or generates images, such as remote sensing, photogrammetry, and thematic mapping. It can be used in a wide variety of application areas, including general business applications, online imagery and photo archiving, environmental monitoring and assessment, geological engineering and exploration, natural resource management, defense, emergency response, telecommunications, transportation, urban planning, and even medical imagery.

Note:

To use GeoRaster, you must understand the main concepts, data types, techniques, operators, procedures, and functions of Oracle Spatial, which are documented in Oracle Spatial User's Guide and Reference.

You should also be familiar with raster and image concepts and terminology, techniques for capturing or creating raster data, and techniques for processing raster data. For example, this guide mentions that data can be georeferenced if it is georectified; however, it does not explain the process of rectification and orthorectification or the challenges and techniques involved.

GeoRaster uses and depends upon several components that are included with Oracle Database, including the Java virtual machine (JVM), Oracle XML DB, and the ORDSYS schema (used for interMedia data types).

Note:

If you are upgrading from a previous release of Oracle Database, you must ensure that Oracle XML DB Repository is installed and that the value of the COMPATIBILITY database initialization parameter is 10.0 or greater. For more information, see the appendix about installation, compatibility, and upgrade issues in Oracle Spatial User's Guide and Reference.

This chapter contains the following major sections:

1.1 Vector and Raster Data

Geographic features can be represented in vector or raster format, or both. With vector data, points are represented by their explicit x,y,z coordinates, lines are strings of points, and areas are represented as polygons whose borders are lines. This kind of vector format can be used to record precisely the location and shape of spatial objects. With raster data, you can represent spatial objects by assigning values to the cells that cover the objects, and you can represent the cells as arrays. This kind of raster format has less precision than vector format, but it is ideal for many types of spatial analysis.

In the raster geographic information systems (GIS) world, this kind of raster data is normally called gridded data. In image processing systems, the raster data representations are typically called images instead of grids. Despite any differences between grids and images, both forms of spatial information are usually represented as matrix structures (that is, arrays of cells), and each cell is usually regularly aligned in the space.

1.2 Raster Data Sources

Raster data is collected and used by a variety of geographic information technologies, including remote sensing, airborne photogrammetry, cartography, and global positioning systems. The collected data is then analyzed by digital image processing systems, computer graphics applications, and computer vision technologies. These technologies use several data formats and create a variety of products.

This section briefly describes some of the main data sources and uses for GeoRaster, focusing on concepts and techniques you need to be aware of in developing applications. It does not present detailed explanations of the technologies; you should consult standard textbooks and reference materials for that information.

1.2.1 Remote Sensing

Remote sensing obtains information about an area or object through a device that is not physically connected to the area or object. For example, the sensor might be in a satellite, balloon, airplane, boat, or ground station. The sensor device can be any of a variety of devices, including a frame camera, pushbroom (swath) imager, synthetic aperture radar (SAR), hydrographic sonar, or paper or film scanner. Remote sensing applications include environmental assessment and monitoring, global change detection and monitoring, and natural resource surveying.

The data collected by remote sensing is often called geoimagery. The wavelength, number of bands, and other factors determine the radiometric characteristics of the geoimages. The geoimages can be single-band, multiband, or hyperspectral, all of which can be managed by GeoRaster. These geoimages can cover any area of the Earth (especially for images sensed by satellite). The temporal resolution can be high, such as with meteorological satellites, making it easier to detect changes. For remote sensing applications, various types of resolution (temporal, spatial, spectral, and radiometric) are often important.

1.2.2 Photogrammetry

Photogrammetry derives metric information from measurements made on photographs. Most photogrammetry applications use airborne photos or high-resolution images collected by satellite remote sensing. In traditional photogrammetry, the main data includes images such as black and white photographs, color photographs, and stereo photograph pairs.

Photogrammetry rigorously establishes the geometric relationship between the image and the object as it existed at the time of the imaging event, and enables you to derive information about the object from its imagery. The relationship between image and object can be established by several means, which can be grouped in two categories: analog (using optical, mechanical, and electronic components) or analytical (where the modeling is mathematical and the processing is digital). Analog solutions are increasingly being replaced by analytical/digital solutions, which are also referred to as softcopy photogrammetry.

The main product from a softcopy photogrammetry system may include digital elevation models (DEMs) and orthoimagery. GeoRaster can manage all this raster data, together with its georeferencing information.

1.2.3 Geographic Information Systems

A geographic information system (GIS) captures, stores, and processes geographically referenced information. GIS software has traditionally been either vector-based or raster-based; however, with the GeoRaster feature, Oracle Spatial handles both raster and vector data.

Raster-based GIS systems typically process georectified gridded data. Gridded data can be discrete or continuous. Discrete data, such as political subdivisions, land use and cover, bus routes, and oil wells, is usually stored as integer grids. Continuous data, such as elevation, aspect, pollution concentration, ambient noise level, and wind speed, is usually stored as floating-point grids. GeoRaster can store all this data.

The attributes of a discrete grid layer are stored in a relational table called a value attribute table (VAT). A VAT contains columns specified by the GIS vendor, and may also contain user-defined columns. The VAT can be stored in the Oracle database as a plain table. The VAT name can be registered within the corresponding GeoRaster object so that raster GIS applications can use the table.

1.2.4 Cartography

Cartography is the science of creating maps, which are two-dimensional representations of the three-dimensional Earth (or of a non-Earth space using a local coordinate system). Today, maps are digitized or scanned into digital forms, and map production is largely automated. Maps stored on a computer can be queried, analyzed, and updated quickly.

There are many types of maps, corresponding to a variety of uses or purposes. Examples of map types include base (background), thematic, relief (three-dimensional), aspect, cadastral (land use), and inset. Maps usually contain several annotation elements to help explain the map, such as scale bars, legends, symbols (such as the north arrow), and labels (names of cities, rivers, and so on).

Maps can be stored in raster format (and thus can be managed by GeoRaster), in vector format, or in a hybrid format.

1.2.5 Digital Image Processing

Digital image processing is used to process raster data in standard image formats, such as TIF, GIF, JFIF (JPEG), and Sun Raster, as well as in many geoimage formats, such as ERDAS, PCX, and HDF. Image processing techniques are widely used in remote sensing and photogrammetry applications. These techniques are used as needed to enhance, correct, and restore images to facilitate interpretation; to correct for any blurring, distortion, or other degradation that may have occurred; and to classify geo-objects automatically and identify targets. The source, intermediate, and result imagery can be loaded and managed by GeoRaster.

1.2.6 Geology, Geophysics, and Geochemistry

Geology, geophysics, and geochemistry all use digital data and produce some digital raster maps that can be managed by GeoRaster.

  • In geology, the data includes regional geological maps, stratum maps, and rock slide pictures. In geological exploration and petroleum geology, computerized geostratum simulation, synthetic mineral prediction, and 3-D oil field characterization, all of which involve raster data, are widely used.

  • In geophysics, data about gravity, the magnetic field, seismic wave transportation, and other subjects is saved, along with georeferencing information.

  • In geochemistry, the contents of multiple chemical elements can be analyzed and measured. The triangulated irregular network (TIN) technique is often used to produce raster maps for further analysis, and image processing is widely used.

1.3 GeoRaster Data Model

Raster data can have some or all of the following elements:

  • Cells or pixels

  • Spatial domain (footprint)

  • Spatial, temporal, and band reference information

  • Cell attributes

  • Metadata

  • Processing data and map support data

GeoRaster uses a generic raster data model that is component-based, logically layered, and multidimensional. The core data in a raster is a multidimensional matrix of raster cells. Each cell is one element of the matrix, and its value is called the cell value. If the GeoRaster object represents an image, a cell can also be called a pixel, which has only one value. (In GeoRaster, the terms cell and pixel are interchangeable.) The matrix has a number of dimensions, a cell depth, and a size for each dimension. The cell depth is the data size of the value of each cell. The cell depth defines the range of all cell values, and it applies to each single cell, not to an array of cells. This core raster data set can be blocked for optimal storage and retrieval.

The data model has a logically layered structure. The core data consists of one or more logical layers. For example, for multichannel remote sensing imagery, the layers are used to model the channels of the imagery. (Bands and layers are explained in Section 1.5.) In the current release, each layer is a two-dimensional matrix of cells that consists of the row dimension and the column dimension.

GeoRaster data has metadata and attributes, and each layer of the GeoRaster data can have its own metadata and attributes. In the GeoRaster data model, all data other than the core cell matrix is the GeoRaster metadata. The GeoRaster metadata is further divided into different components (and is thus called component-based), which contain the following kinds of information:

  • Object information

  • Raster information

  • Spatial reference system information

  • Date and time (temporal reference system) information

  • Band reference system information

  • Layer information for each layer

Based on this data model, GeoRaster objects are described by the GeoRaster metadata XML schema (described in Appendix A), which is used to organize the metadata. Some schema components and subcomponents are required and others are optional. You must understand this XML schema if you develop GeoRaster loaders, exporters, or other applications. This XML schema can also be extended to include any kind of raster metadata that is not already included in the schema. Some restrictions on the metadata exist for the current release, and these are described in the Usage Notes for the SDO_GEOR.validateGeoraster function (documented in Chapter 4), which checks the validity of the metadata for a GeoRaster object.

The GeoRaster object data types, described in Chapter 2, are based on the GeoRaster data model.

In this data model, two different types of coordinates need to be considered: the coordinates of each pixel (cell) in the raster matrix and the coordinates on the Earth that they represent. Consequently, two types of coordinate systems or spaces are defined: the cell coordinate system and the model coordinate system.

The cell coordinate system (also called the raster space) is used to describe pixels in the raster matrix, and its dimensions are (in this order) row, column, and band. The model coordinate system (also called the ground coordinate system or the model space) is used to describe points on the Earth or any other coordinate system associated with an Oracle SRID value. The spatial dimensions of the model coordinate system are (in this order) X and Y, corresponding to the column and row dimensions, respectively, in the cell coordinate system. The logical layers correspond to the band dimension in the cell space.

Figure 1-1 shows the relationship between a raster image and its associated geographical (spatial) extent, and between parts of the image and their associated geographical entities.

Figure 1-1 Raster Space and Model Space

Description of Figure 1-1 follows
Description of "Figure 1-1 Raster Space and Model Space"

In Figure 1-1:

  • In the objects on the left, the medium-size rectangle represents a raster image, and within it are a rectangular area showing a national park and a point identifying the location of a specific restaurant. Each pixel in the image can be identified by its coordinates in a cell coordinate system (the coordinate system associated with the raster image). The upper-left corner of the medium-size rectangle has the coordinate values associated with the ULTCoordinate value of the cell space for the GeoRaster object.

  • In the objects on the right, the large rectangle represents the geographical area (in the model, or ground, space) that is shown in the raster image, and within it are spatial geometries for the national park and the specific restaurant. Each entire geographical area and geometries within it can be identified using coordinates in its model (or, ground) coordinate system, such as WGS 84 for longitude/latitude data.

In GeoRaster, the upper-left corner of the raster data can have a different coordinate in its cell space from the coordinate of the origin of the cell space. In other words, the (row, column) coordinate of the upper-left corner is not necessarily (0,0). The upper-left corner is called the ULTCoordinate, and its value is registered in the metadata. If there is a band dimension, the ULTCoordinate value is always (row,column,0). The coordinate of each cell is relative to the origin of the cell space, not to the ULTCoordinate value. The origin of the cell coordinate system may not be exactly at the ULTCoordinate value.

For two-dimensional single-layer GeoRaster data, the cell coordinate system has a column dimension pointing to the right and a row dimension pointing downward, as shown in Figure 1-1. The unit is in cells, or pixels, and the cell coordinates are identified by integer column and row numbers. For a multiband image, the axis along bands is called the band dimension. For a time series multilayer image (where each layer has a different date or timestamp), the axis along layers is called the temporal dimension. Three-dimensional GeoRaster data includes the vertical dimension, which is vertical to both the row and column dimensions.


Note:

Only row, column, and band dimensions in the cell coordinate system are currently supported. The row and column dimensions are used to model two-dimensional spatial coordinates. The band dimension can be used to model multichannel remote sensing imagery or photographs and any other types of layers, such as temporal layers and multiple-grid themes.

The model coordinate system consists of spatial dimensions, and other dimensions if there are any. The spatial dimensions are called the x, y, and z dimensions, and values in these dimensions can be associated with a geodetic, projected, or local coordinate system. Other dimensions include spectral and temporal dimensions (called the s dimension and t dimension, respectively). GeoRaster currently supports only two spatial dimensions (X,Y) in the model coordinate system. (For information about coordinate systems, including the different types of coordinate systems, see Oracle Spatial User's Guide and Reference.)

The relationships between cell coordinates and model coordinates are modeled by GeoRaster reference systems (mapping schemes). The following GeoRaster reference systems are defined:

  • Spatial reference system, also called GeoRaster SRS, which maps cell coordinates (row,column,vertical) to model coordinates (X,Y,Z). Using the spatial reference system with GeoRaster data is referred to as georeferencing the data. (Georeferencing is discussed in Section 1.6.)

  • Temporal reference system, also called GeoRaster TRS, which maps cell coordinates (temporal) to model coordinates (T).

  • Band reference system, also called GeoRaster BRS, which maps cell coordinates (band) to model coordinates (S, for Spectral).

Each of these reference systems is currently defined, at least partially, in the GeoRaster XML schema. However, for the current release, only the two-dimensional spatial reference system is supported. This means that only the relationship between (row,column) and (X,Y) coordinates can be mapped. If the model coordinate system is geodetic, (X,Y) means (longitude,latitude). The temporal and band reference systems can be used, however, to store useful temporal and spectral information, such as the spectral resolution and when the raster data was collected.

Other metadata is stored in the <layerInfo> element in the GeoRaster XML metadata, as explained in Section 1.5.

1.4 GeoRaster Physical Storage

As mentioned in Section 1.3, GeoRaster data consists of a multidimensional matrix of cells and the GeoRaster metadata. Most metadata is stored as an XML document using the Oracle XMLType data type. The metadata is defined according to the GeoRaster metadata XML schema, which is described in Appendix A. The spatial extent (footprint) of a GeoRaster object is part of the metadata, but it is stored separately as an attribute of the GeoRaster object. This approach allows GeoRaster to take advantage of the spatial geometry type and related capabilities, such as using R-tree indexing on GeoRaster objects.

The multidimensional matrix of cells is blocked into small subsets for large-scale GeoRaster object storage and optimal retrieval and processing. Each block is stored in a table as a binary large object (BLOB), and a geometry object (of type SDO_GEOMETRY) is used to define the precise extent of the block. Each row of the table stores only one block and the blocking information related to that block. (This blocking scheme applies to any pyramids also.)

The dimension sizes (along row, column, and band dimensions) may not be evenly divided by their respective block sizes. GeoRaster adds padding to the boundary blocks that do not have enough original cells to be completely filled. The boundary blocks are the end blocks along the positive direction of each dimension. The padding cells have the same cell depth as other cells and have values equal to zero. Padding makes each block have the same BLOB size. Padding mainly applies to row and column blocks, but for multiband and hyperspectral imagery, padding can be applied to the band dimension also. For example, assume the following specification: band interleaved by line, blocking as (64,64,3), and 8 bands, each with 64 rows and 64 columns. In this case:

  1. Bands 0, 1, and 2 are stored interleaved by line in the first block.

  2. Bands 3, 4, and 5 are stored interleaved by line in the second block.

  3. The third block holds the following in this order: line 1 of band 6, line 1 of band 7, 64 column values that are padding, line 2 of band 6, line 2 of band 7, 64 column values that are padding, and so on, until all 64 rows are stored.

However, the top-level pyramids are not padded if both the row and column dimension sizes of the pyramid level are less than or equal to one-half the row block size and column block size, respectively. See Section 1.7 for information about the physical storage of pyramids.

If the cell depth is greater than 8 bits, GeoRaster cell data is stored in big-endian format in raster blocks (BLOBs). If the cell depth is less than 8 bits, each byte in the raster blocks (BLOBs) contains two or more cells, so that the bits of a byte are fully filled with cell data. The cells are always filled into the byte from left to right. For example, if the cell depth is 4 bits, one byte contains two cells: the first four bits of the byte contain the value of a cell, and the second four bits contain the value of its following cell, which is determined by the interleaving type.

Based on this physical storage model, two object types are provided: SDO_GEORASTER for the raster data set and related metadata, and SDO_RASTER for each block in a raster image.

  • The SDO_GEORASTER object contains a spatial extent geometry (footprint or coverage extent) and relevant metadata. A table containing one or more columns of this object type is called a GeoRaster table.

  • The SDO_RASTER object contains information about a block (tile) of a GeoRaster object, and it uses a BLOB object to store the raster cell data for the block. An object table of this object type is called a raster data table (RDT).

Each SDO_GEORASTER object has a pair of attributes (rasterDataTable, rasterID) that uniquely identify the RDT and the rows within the RDT that are used to store the raster cell data for the GeoRaster object.

Figure 1-2 shows the storage of GeoRaster objects, using as an example an image of Boston, Massachusetts in a table that contains rows with images of various cities.

Figure 1-2 Physical Storage of GeoRaster Data

Description of Figure 1-2 follows
Description of "Figure 1-2 Physical Storage of GeoRaster Data"

As shown in Figure 1-2:

  • Each row in the table of city images contains information about the image for a specific city (such as Boston), including an SDO_GEORASTER object.

  • The SDO_GEORASTER object includes the spatial extent geometry covering the entire area of the image, the metadata, the raster ID, and the name of the raster data table associated with this image.

  • Each row in the raster data table contains information about a block (or tile) of the image, including the block's minimum bounding rectangle (MBR) and image data (stored as a BLOB). The raster data table is described in Section 1.4.2.

The SDO_GEORASTER and SDO_RASTER object types are described in detail in Chapter 2.

Figure 1-3 shows the physical storage of GeoRaster data and several related objects in a database.

Figure 1-3 GeoRaster Data in an Oracle Database

Description of Figure 1-3 follows
Description of "Figure 1-3 GeoRaster Data in an Oracle Database"

In Figure 1-3:

  • Each GeoRaster object in the GeoRaster table has an associated raster data table, which has an entry for each block of the raster image.

  • The BLOB with image data for each raster image block is stored separately from the raster table data. You can specify storage parameters (described in Section 1.4.1) for the BLOBs.

  • Each GeoRaster object has a raster data table associated with it. However, a raster data table can store blocks of multiple GeoRaster objects, and GeoRaster objects in a GeoRaster table can be associated with one or multiple raster data tables.

  • GeoRaster system data (described in Section 2.4) maintains the relationship between the GeoRaster tables and the raster data tables.

  • Indexes (standard and Spatial) can be built on the GeoRaster table and raster data tables. For information about indexing GeoRaster data, see Section 3.8.

  • Additional tables, such as ground control point (GCP) tables and value attribute tables (VATs), can be related to the GeoRaster objects.

You should maintain a one-to-many relationship between a GeoRaster table and its associated raster data tables. That is, you should let a raster data table only contain cell data of GeoRaster objects that belong to the same GeoRaster table.

The following considerations apply to schema, table, and column names that are stored in any Oracle Spatial metadata views. For example, these considerations apply to geometry tables, GeoRaster tables, raster data tables, and geometry and GeoRaster columns.

  • The name must contain only letters, numbers, and underscores. For example, the name cannot contain a space ( ), an apostrophe ('), a quotation mark ("), or a comma (,).

  • All letters in the names are converted to uppercase before the names are stored in geometry metadata views or GeoRaster system data (xxx_SDO_GEOR_SYSDATA) views or before the tables are accessed. This conversion also applies to any schema name specified with the table name.

For more information about raster data tables, see Section 1.4.2.

For information about cross-schema support with GeoRaster tables and raster data tables, see Section 1.4.4.

1.4.1 Storage Parameters

Several GeoRaster operations let you specify or change aspects of the storage. The relevant subprograms contain a parameter named storageParam, which is a quoted string of keywords and their values. The storageParam parameter keywords apply to characteristics of the raster data (see Table 1-1).


Note:

The keywords in this section either do not apply or only partially apply to the storageParam parameter of the SDO_GEOR.importFrom procedure and the subsetParam parameter of the SDO_GEOR.exportTo procedure. See the reference information about the relevant parameters for each of these procedures in Chapter 4.

Table 1-1 storageParam Keywords for Raster Data

Keyword Explanation

blocking

Specifies whether or not raster data is blocked. TRUE causes raster data to be blocked using the blocks of the specified or default blockSize value; FALSE causes raster data not to be blocked (that is, only one block will be used for the entire image).

The default value for blocking is TRUE if you specify the blockSize keyword. If you specify blocking=TRUE but do not specify the blockSize keyword, the default blockSize is (256,256,B), where B is the number of bands in the output GeoRaster object. If you specify neither blocking nor blockSize, default values are derived from the source GeoRaster object: that is, if the original data is not blocked, the data in the output GeoRaster object is by default not blocked; and if the original data is blocked, the data in the output GeoRaster object is blocked with the same blocking scheme.

blockSize

Specifies the block size, that is, the number of cells per block. You must specify a value for each dimension of the output GeoRaster object. For example, blocksize=(256,64,3) specifies 256 for the row dimension, 64 for the column dimension, and 3 for the band dimension; and blocksize=(128,128) specifies row and column block sizes of 128 for a GeoRaster object that has no band dimension. For the row and column dimensions, the value must be a positive integer equal to 1 or a positive power of 2. For the band dimension, the value can be any positive integer; although if it is greater than the total number of bands, padding is applied. (These requirements apply only to the use of the blocksize keyword to perform reblocking; the dimension sizes of the original GeoRaster object can be any values.) See also the explanation of the blocking keyword.

Only regular blocking is supported; that is, all blocks must be the same size and be aligned with each other, except for some top-level pyramids.

cellDepth

Specifies the cell depth of the raster data set, which indicates the number of bits and the sign for the data type of all cells. Note, however, that changing the cell depth can cause loss of data and a reduction in precision and image quality. Must be one of the following values (_U indicating unsigned and _S indicating signed): 1BIT, 2BIT, 4BIT, 8BIT_U, 8BIT_S, 16BIT_U, 16BIT_S, 32BIT_U, 32BIT_S, 32BIT_REAL, or 64BIT_REAL. If cellDepth is not specified, the value from the source GeoRaster object is used by default. Example: celldepth=16BIT_U

compression

Specifies the compression type to be applied to the GeoRaster object. Must be one of the following values: JPEG-B, JPEG-F, DEFLATE, or NONE. (You can use NONE to decompress a compressed GeoRaster object.) If compression is not specified, the compression type of the source GeoRaster object is used. For more information about compression and decompression, see Section 1.8. Example: compression=JPEG-F

If the source GeoRaster object is blank, the compression keyword is ignored, except for the SDO_GEOR.getRasterSubset and SDO_SDO_GEOR.getRasterData functions. (Blank GeoRaster objects are explained in Section 1.4.3.)

The compression keyword is not supported in the storageParam parameter for the deprecated SDO_GEOR.changeFormat and SDO_GEOR.scale procedures; however, it is supported for the SDO_GEOR.changeFormatCopy and SDO_GEOR.scaleCopy procedures.

interleaving

Specifies the interleaving type. Must be one of the following values: BSQ (band sequential), BIL (band interleaved by line), or BIP (band interleaved by pixel). Example: interleaving=BSQ

pyramid

TRUE specifies to keep the original pyramid data; FALSE specifies not to keep the original pyramid data. The default value depends on the specific procedure: the default is TRUE for SDO_GEOR.copy, SDO_GEOR.changeFormat, and SDO_GEOR.changeFormatCopy; the default is FALSE for SDO_GEOR.scale, SDO_GEOR.scaleCopy, SDO_GEOR.mosaic, and SDO_GEOR.subset. (A value of TRUE is invalid and is ignored for SDO_GEOR.scale, SDO_GEOR.scaleCopy, SDO_GEOR.mosaic, or SDO_GEOR.subset.)

You cannot generate pyramid data through the use of storage parameters; instead, you must use the SDO_GEOR.generatePyramid procedure after creating the GeoRaster object.

quality

Specifies the JPEG compression quality, which is the degree of lossiness caused by the compression. Must be an integer from 0 (lowest quality) through 100 (highest quality) to be applied to the GeoRaster object. The default value is 75. For more information about compression quality, see Section 1.8.1. Example: quality=80


Example 1-1 shows a GeoRaster object being copied, with its block size changed and any pyramid data from the original object not copied.

Example 1-1 Using storageParam Keywords

DECLARE
   gr1 sdo_georaster;
   gr2 sdo_georaster;
BEGIN
INSERT INTO georaster_table (georid, georaster) VALUES (2, sdo_geor.init('RDT_1'))
       RETURNING georaster INTO gr2;
SELECT georaster INTO gr1 FROM georaster_table WHERE georid=1;
sdo_geor.changeFormatCopy(gr1, 'blocksize=(128,128) pyramid=FALSE', gr2);
UPDATE georaster_table SET georaster=gr2 WHERE georid=2;
COMMIT;
END;
/

In Example 1-1, the raster data table for GeoRaster object gr2 is RDT_1. If raster data is to be written into table RDT_1, that table must exist before the PL/SQL block is run; otherwise, an error is generated by the SDO_GEOR.changeFormatCopy procedure.

Note:

If you insert, update, or delete GeoRaster cell data or metadata, update the GeoRaster object before committing the transaction, as shown in Example 1-1 and as explained in Section 3.16.

Example 1-1 and many examples in Chapter 4 refer to a table named GEORASTER_TABLE, which has the following definition:

CREATE TABLE georaster_table
( georid    NUMBER,
  name      VARCHAR2(32),
  georaster SDO_GEORASTER );

CALL SDO_GEOR_UTL.createCMLTrigger('georaster_table', 'georaster');

1.4.2 Raster Data Table

A raster data table must be an object table of SDO_RASTER type, and it must have the primary key defined on the columns (rasterID, pyramidLevel, bandBlockNumber, rowBlockNumber, columnBlockNumber).

You can control the placement and storage characteristics of the raster data table (for example, if the table should be partitioned for better performance). Specifying a large CHUNK size (8, 16, or 32 KB) for the rasterBlock LOB column improves performance. (The CHUNK value must be greater than the database block size.) For a large GeoRaster object, consider putting its raster data in a separate raster data table and partitioning the raster data table by pyramid level or block numbers, or both.

Each raster data table name must be unique in the database. To resolve any duplication in raster data table names, you can use the SDO_GEOR_UTL.makeRDTNamesUnique or SDO_GEOR_UTL.renameRDT procedure, both of which are documented in Chapter 5.

Example 1-2 creates a raster data table named RDT_1 (the same name specified in Example 1-1).

Example 1-2 Creating a Raster Data Table

CREATE TABLE rdt_1 OF SDO_RASTER
  (PRIMARY KEY (rasterID, pyramidLevel, bandBlockNumber,
    rowBlockNumber, columnBlockNumber))
  TABLESPACE geor_tbs NOLOGGING
  LOB(rasterBlock) STORE AS rdt_1_rbseg
    (TABLESPACE  geor_tbs_2
     CHUNK 8192
     CACHE READS
     NOLOGGING
     PCTVERSION 0
     STORAGE (PCTINCREASE 0)
    );

For reference information about creating tables, including specifying LOB storage, see the section about the CREATE TABLE statement in Oracle Database SQL Reference.

Do not use the SYSTEM tablespace for storing GeoRaster tables and raster data tables. Instead, create separate locally managed (the default) tablespaces for GeoRaster tables.

In choosing block sizes for raster data, consider the following:

  • The maximum length of a raster block is 4 GB; therefore, do not specify a block size greater than 4 GB.

  • Consider the cellDepth value of the GeoRaster object when you calculate the desired size for a raster block.

  • Choosing an appropriate block size is a trade-off between the size of a raster block and the number of blocks needed for a GeoRaster object. A blocking size value that results in a raster block close to 4 KB is usually a bad choice, because 4 KB is the threshold for storing an Oracle BLOB out-of-line.

1.4.3 Blank and Empty GeoRaster Objects

A blank GeoRaster object is a special type of GeoRaster object in which all cells have the same value. There is no need to store its cells in any SDO_RASTER block; instead, the cell value is registered in the metadata in the blankCellValue element. Otherwise, blank GeoRaster objects are treated in the same way as other GeoRaster objects. Use the SDO_GEOR.createBlank function to create a blank GeoRaster object, the SDO_GEOR.isBlank function to check if a GeoRaster object is a blank GeoRaster object, and the SDO_GEOR.getBlankCellValue function to return the value of the cells in a blank GeoRaster object.

An empty GeoRaster object contains only a rasterDataTable name and a rasterID. To create an empty GeoRaster object, use the SDO_GEOR.init function. You must create an empty GeoRaster object before you perform an action that outputs a new GeoRaster object, so that the output can be stored in the previously initialized empty GeoRaster object.

1.4.4 Cross-Schema Support with GeoRaster

A GeoRaster table and its associated raster data table or tables must have the same owner. However, users with appropriate privileges can create GeoRaster tables and associated raster data tables owned by other schemas, and they can also create, query, update, and delete GeoRaster objects owned by other schemas. For cross-schema query of GeoRaster objects, you must have the SELECT privilege on the GeoRaster tables and their associated raster data tables. For cross-schema update of GeoRaster objects, you must have the SELECT, INSERT, UPDATE, and DELETE privileges on the GeoRaster tables and their associated raster data tables.

The ALL_SDO_GEOR_SYSDATA view (described in Section 2.4) contains information about all GeoRaster objects accessible to the current user. For each object listed, the GeoRaster table must be accessible by the current user. If the current user also needs to access the raster data, that user must also have the appropriate privileges on the associated raster data table.

All SDO_GEOR subprograms can work on GeoRaster objects defined in schemas other than the current connection schema.

1.5 Bands, Layers, and Interleaving

In GeoRaster, band and layer are different concepts. Band is a physical dimension of the multidimensional raster data set; that is, it is one ordinate in the cell space. For example, the cell space might have the ordinates row, column, and band. Bands are numbered from 0 to n-1, where n is the highest layer number. Layer is a logical concept in the GeoRaster data model. Layers are mapped to bands. Typically, one layer corresponds to one band, and it consists of a two-dimensional matrix of size rowDimensionSize and columnDimensionSize. Layers are numbered from 1 to n; that is, layerNumber = bandNumber + 1.

A GeoRaster object can contain multiple bands, which can also be called multiple layers. For example, electromagnetic wave data from remote sensing devices is grouped into a certain number of channels, where the number of possible channels depends on the capabilities of the sensing device. Multispectral images contain multiple channels, and hyperspectral images contain a very large number (say, 50 or more) of channels. The channels are all mapped into GeoRaster bands, which are associated with layers.

In raster GIS applications, a data set can contain multiple raster layers, and each layer is called a theme. For example, a raster may have a population density layer, where different cell values are used to depict neighborhoods or counties depending on their average number of inhabitants per square mile or kilometer. Other examples of themes might be average income levels, land use (agricultural, residential, industrial, and so on), and elevation above sea level. The raster GIS themes can be stored in different GeoRaster objects or in one GeoRaster object, and each theme is modeled as one layer. The raster themes and multispectral image channels can also be stored together in one GeoRaster object as different layers, as long as they have the same dimensions.

Figure 1-4 shows an image with multiple layers and a single raster data table. Each layer contains multiple blocks, each of which typically contains many cells. Each block has an entry in the raster data table. Note that GeoRaster starts layer numbering at 1 and band numbering at 0 (zero), as shown in Figure 1-4.

Figure 1-4 Layers, Bands, and the Raster Data Table

Description of Figure 1-4 follows
Description of "Figure 1-4 Layers, Bands, and the Raster Data Table"

The GeoRaster XML metadata refers to the object layer and to layers. The object layer refers to the whole GeoRaster object, which may or may not contain multiple layers. If the GeoRaster object contains multiple layers, each layer is a sublayer of the object layer, and it refers to a single band.

Each layer can have an optional set of metadata associated with it. The metadata items for a layer include the layer ID, description, scaling function, bin function, statistical data set (including histogram), grayscale lookup table, and colormap (or, pseudocolor lookup table, also called a PCT). Applications can use the available metadata information. For example, to display a 64-bit GeoRaster object, a typical approach is to process the original cell values through scaling or binning so that the cell value range is less than the 64-bit range and thus can be displayed on a normal monitor. The metadata items are defined in the GeoRaster metadata XML schema, which is presented in Appendix A. See also the explanations of the SDO_GEOR_COLORMAP object type in Section 2.3.2 and SDO_GEOR_GRAYSCALE object type in Section 2.3.3.

The metadata associated with the object layer applies to the whole GeoRaster object. The metadata associated with a layer applies only to that layer. For example, the statistical data set for the object layer is calculated based on all cells of the GeoRaster object, regardless of how many layers the object has; but the statistical data for a layer is calculated based only on the cells in that layer.

The metadata for the object layer and other layers is stored using <layerInfo> elements in the GeoRaster XML metadata, which is described in Appendix A, and sometimes in separate tables, such as a colormap table or a histogram table. Metadata stored in the GeoRaster XML metadata is managed by GeoRaster, and you can use the GeoRaster API to retrieve and modify this metadata. For metadata stored in separate tables, the table name can be registered in the GeoRaster XML schema, in which case applications can retrieve the name of the table. However, GeoRaster does not check the existence or validity of that table or provide any operations on that table.

Three types of interleaving are supported: BSQ (band sequential), BIL (band interleaved by line), and BIP (band interleaved by pixel). Interleaving applies between bands or layers only. Interleaving is limited to the interleaving of cells inside each block of a GeoRaster object. This means GeoRaster always applies blocking on a GeoRaster object first, and then it applies interleaving inside each block independently. However, each block of the same GeoRaster object has the same interleaving type. You can change the interleaving type of a copy of a GeoRaster object by calling SDO_GEOR.changeFormatCopy procedure, so that the data can be more efficiently processed and used.

1.6 Georeferencing

The GeoRaster spatial reference system (SRS), a metadata component of the GeoRaster object, includes information related to georeferencing. Georeferencing establishes the relationship between cell coordinates of GeoRaster data and real-world ground coordinates (or some local coordinates). Georeferencing assigns ground coordinates to cell coordinates, and cell coordinates to ground coordinates.

In GeoRaster, georeferencing is different from geocorrection, rectification, or orthorectification. In these three latter processes, cell resampling is often performed on the raster data, and the resulting GeoRaster data might have a different model coordinate system and dimension sizes. Georeferencing establishes the relationship between cell coordinates and real-world coordinates or some local coordinates. Georeferencing can be accomplished by providing an appropriate mathematical formula, enough ground control point (GCP) coordinates, or rigorous model data from the remote sensing system. Georeferencing does not change the GeoRaster cell data or other metadata, except as needed to facilitate the transformation of coordinates between the cell coordinate system and the model coordinate system.

GeoRaster currently supports six-parameter affine transformation that georeferences two-dimensional raster data. The affine transformation is a special type of the Functional Fitting polynomial model. If an affine transformation is provided and is valid in the metadata, the GeoRaster object is considered georeferenced, and the isReferenced value in the SRS metadata will be TRUE; otherwise, it should be FALSE.

Rectification can be done with horizontal coordinates, so that cells of a GeoRaster data set can be mapped to a projection map coordinate system. After rectification, each cell is regularly sized in the map units and is aligned with the model coordinate system, that is, with the East-West dimension and the North-South dimension. If elevation data (DEM) is used in rectification, it is called orthorectification, a special form of rectification that corrects terrain displacement. If a GeoRaster object is rectified, the isRectified value in its metadata will be TRUE; otherwise, it should be FALSE. If a GeoRaster object is orthorectified, the isOrthoRectified value in its metadata will be TRUE; otherwise, it should be FALSE.

To georeference a GeoRaster object, see Section 3.6.

1.6.1 GeoRaster Georeferencing Method

In the current release, GeoRaster uses low order polynomials when georeferencing image or raster data according to the following six-parameter affine transformation formulas:

row = a + b * x + c * y
col = d + e * x + f * y

In these formulas:

  • row = Row index of the cell in raster space.

  • col = Column index of the cell in raster space.

  • x = East-West position of the point on the ground or in model space.

  • y = North-South position of the point on the ground or in model space.

  • a, b, c, d, e, and f are coefficients, and they are stored in the SRS metadata.

  • b*f – c*e should not be equal to 0 (zero).

In the formulas, if b = 0, f = 0, c = -e, and both c and e are not 0 (zero), the raster data is rectified, and the formula becomes:

row = a + c * y
col = d - c * x

This is the simplest case for georeferencing.

In the current release, the cellRepresentationType value must be UNDEFINED. In other words, a cell is just a scalar value (or an element of an array) without any shape defined in its cell space. However, when the GeoRaster object is georeferenced, each cell covers a specific square or rectangular area or represents a point of this area in the model space. In the cell space, each cell has an integer coordinate. Through georeferencing, the cell's integer coordinate can be transformed into model coordinates, which identify an exact location of a point. This point or model coordinate may be either the upper-left corner or the center of the area represented by the cell in the model space.

The model coordinates have the same unit as that of the specified SRID and should be in the value range defined by the model coordinate system. For example, if the GeoRaster object is georeferenced to a geodetic coordinate system such as 8307, the unit of the model coordinates derived from the SRS must be decimal degrees, and values should be in the ranges of -180.0 to +180.0 for longitude and -90.0 to +90.0 for latitude. In this case, you cannot use meters or other unit.

In the GeoRaster XML schema, the modelCoordinateLocation element specifies whether the base of the area in the model space represented by a cell is at the upper-left corner or the center of the area, as follows:

<xsd:element name="modelCoordinateLocation" minOccurs="0">
        <xsd:simpleType>
                 <xsd:restriction base="xsd:string">
                          <xsd:enumeration value="CENTER"/>
                          <xsd:enumeration value="UPPERLEFT"/>
                 </xsd:restriction>
        </xsd:simpleType>
</xsd:element>

If the original georeferencing information in the source data is in the inverse direction, such as in an ESRI world file, the transformation formulas are the following:

x = A * col + B * row + C
y = D * col + E * row + F

In this case, the preceding A, B, C, D, E, and F coefficients that you specify to the SDO_GEOR.georeference procedure are automatically adjusted internally to produce the correct georeferencing result: a, b, c, d, e, and f coefficients.

1.6.2 Cell Coordinate and Model Coordinate Transformation

Cell coordinate and model coordinate transformations are based on the GeoRaster spatial reference system (SRS) and the ULTCoordinate (upper-left coordinate) of the raster data. (The SRS and the ULTCoordinate are described in Section 1.3.) The ULTCoordinate can have a different coordinate (row and column values) from the coordinate of the origin of the cell space. That is, the (row, column) coordinate of the upper-left corner is not necessarily (0,0). For any transformation between the cell space and the model space, the values of the ULTCoordinate must be taken into consideration.

Both before and after transformation using the GeoRaster SRS, the (row, column) coordinate values of a cell are in the GeoRaster cell space, and these values take the ULTCoordinate into consideration, as shown in the following formulas:

row = row0 + m
col = col0 + n

In these formulas:

  • row = Row index (starting at 0 for the first row) of the cell relative to the origin of cell space.

  • col = Column index (starting at 0 for the first column) of the cell relative to the origin of cell space.

  • row0 = Row index (starting at 0 for the first row) of the ULTCoordinate relative to the origin of cell space.

  • col0 = Column index (starting at 0 for the first column) of the ULTCoordinate relative to the origin of cell space.

  • m = Row index (that is, the mth row, starting at 0 for the first row) of the cell relative to the ULTCoordinate.

  • n = Column index (that is, the nth column, starting at 0 for the first column) of the cell relative to the ULTCoordinate.

In most applications, the ULTCoordinate and the origin of cell space are the same (that is, row0 = 0 and col0 = 0), in which case row = m and col = n.

1.7 Pyramids

Pyramids are subobjects of a GeoRaster object that represent the raster image or raster data at differing sizes and degrees of resolution. The size is usually related to the amount of time that an application needs to retrieve and display an image, particularly over the Web. That is, the smaller the image size, the faster it can be displayed; and as long as detailed resolution is not needed (for example, if the user has "zoomed out" considerably), the display quality for the smaller image is adequate.

Pyramid levels represent reduced or increased resolution images that require less or more storage space, respectively. (GeoRaster currently supports only reduced resolution pyramids.) A pyramid level of 0 indicates the original raster data; that is, there is no reduction in the image resolution and no change in the storage space required. Values greater than 0 (zero) indicate increasingly reduced levels of image resolution and reduced storage space requirements.

Pyramid type indicates the type of pyramid, and can be one of the following values:

  • DECREASE means that pyramids decrease in size as the pyramid level increases.

  • NONE means that there are no pyramids associated with the GeoRaster object.

Figure 1-5 shows the concept of pyramid levels with a pyramid type of DECREASE. It conveys the idea that as the pyramid level number increases, the file size decreases, but the resolution also decreases because fewer pixels are used to represent the image.

Figure 1-5 Pyramid Levels

Description of Figure 1-5 follows
Description of "Figure 1-5 Pyramid Levels"

The size of the pyramid image at each level is determined by the original image size and the pyramid level, according to the following formulas:

r(n) = (int)(r(0) / 2^n)
c(n) = (int)(c(0) / 2^n)

In the preceding formulas:

  • r(0) and c(0) are the original row and column dimension size.

  • r(n) and c(n) are the row and column dimension size of pyramid level n.

  • int rounds off a number to the integer value that is less than but closest to that number.

  • 2^n means 2 to the power of n.

The smaller of the row and column dimension sizes of the top-level overview (the smallest top-level pyramid) is 1. This determines the maximum reduced-resolution pyramid level, which is calculated as follows: (int)(log2(a))

In the preceding calculation:

  • log2 is a logarithmic function with 2 as its base.

  • a is the smaller of the original row and column dimension size.

The pyramids are stored in the same raster data table as the GeoRaster object. The pyramidLevel attribute in the raster data table identifies all the blocks related to a specific pyramid level. In general, the blocking scheme for each pyramid level is the same as that for the original level (which is defined in the GeoRaster object metadata), except in the following cases:

  • If the original GeoRaster object is not blocked, that is, if the original cell data is stored in one block (BLOB) of the exact size of the object, the cell data of each pyramid level is stored in one block, and its size is the same as that of the actual pyramid level image.

  • If the original GeoRaster object is blocked (even if blocked as one block), the cell data of each pyramid level is blocked in the same way as for the original level data, and each block is stored in a different BLOB object as long as the maximum dimension size of the actual pyramid level image is larger than the block sizes. However, if lower-resolution pyramids are generated (that is, if both the row and column dimension sizes of the pyramid level are less than or equal to one-half the row block size and column block size, respectively), the cell data of each such pyramid level is stored in one BLOB object and its size is the same as that of the actual pyramid level image.

When pyramids are generated on a GeoRaster object or when a GeoRaster object is scaled, resampling of cell data is required. GeoRaster provides the following standard resampling methods:

  • Nearest neighbor

  • Bilinear interpolation using 4 neighboring cells

  • Cubic convolution using 16 neighboring cells

  • Average4 using 4 neighboring cells

  • Average16 using 16 neighboring cells

The following subprograms (described in Chapter 4) are associated with GeoRaster support for pyramids:

1.8 Compression and Decompression

GeoRaster provides two types of native compression to reduce storage space requirements for GeoRaster objects: JPEG (JPEG-B or JPEG-F) and DEFLATE. With both types, each block is compressed individually, as a distinct raster representation; and when a compressed GeoRaster object is decompressed, each block is decompressed individually.

Any GeoRaster operation that can be performed on a decompressed (uncompressed) GeoRaster object can also be performed on a compressed GeoRaster object. When GeoRaster performs an operation, if the source GeoRaster object is compressed, GeoRaster internally decompresses blocks of the source object as needed, performs the specified operation, and then compresses the resulting object in the format specified by the compression keyword or, if the compression keyword is not specified, in the source object's compression format. Therefore, you do not need to decompress compressed GeoRaster objects before performing certain operations, but you might gain some overall performance benefit if you decompress the objects before performing other operations.

Before a database user compresses or decompresses a GeoRaster object, ensure that the database has been created with a default temporary tablespace or that the user has been assigned a temporary tablespace or tablespace group. Otherwise, by default the SYSTEM tablespace is used for the temporary tablespace, and large temporary LOB data generated during GeoRaster operations are put in the SYSTEM tablespace, possibly affecting overall database performance. For information about managing temporary tablespaces, see Oracle Database Administrator's Guide.

To specify compression or decompression of a GeoRaster object, use the compression keyword in the storageParam parameter, which is described in Section 1.4.1. You can use the compression keyword in the storageParam parameter with several GeoRaster procedures, including SDO_GEOR.changeFormatCopy, SDO_GEOR.getRasterData, SDO_GEOR.getRasterSubset, SDO_GEOR.importFrom, SDO_GEOR.mosaic, SDO_GEOR.scaleCopy, and SDO_GEOR.subset. (There are no separate procedures for compressing and decompressing a GeoRaster object.)

If the source GeoRaster object is blank, the compression keyword is ignored, except for the SDO_GEOR.getRasterSubset and SDO_GEOR.getRasterData functions. That is, a blank GeoRaster object is never compressed, and the compression type in the metadata is always NONE. (Blank GeoRaster objects are explained in Section 1.4.3.)

This section covers the following topics:

1.8.1 JPEG Compression of GeoRaster Objects

JPEG compression is supported only for GeoRaster objects with a cellDepth value of 8BIT_U and no more than 4 bands per block, and each block must have 1 band, 3 bands, or 4 bands. (2 bands per block is not supported for JPEG compression.) You can JPEG compress GeoRaster objects of more than 4 bands by reblocking the GeoRaster object with a band block size of 1, 3, or 4 bands.

Although JPEG compression is supported for GeoRaster objects of any size, the total size (columnsPerBlock * rowsPerBlock * bandsPerBlock * cellDepth / 8) of each block of the GeoRaster object must not exceed 50 megabytes (MB). For large GeoRaster objects, you can call the SDO_GEOR.changeFormatCopy procedure to block the GeoRaster object into blocks smaller than 50 MB, and then compress the GeoRaster object; or you can perform the blocking and compression in the same call to the SDO_GEOR.changeFormatCopy procedure.

GeoRaster supports the JPEG-B and JPEG-F compression modes:

  • JPEG-B mode compresses objects in the abbreviated baseline JPEG format.

  • JPEG-F mode compresses objects in the full-format baseline JPEG format.

Both modes are described in the CCITT Rec. T.81 JPEG specification (or ICO/IEC IS 10918-1). For both modes, GeoRaster uses the quantization table in Table K.2 of the CCITT Rec. T.81 JPEG specification and (for the Huffman tables) standard chrominance tables in Tables K.4 and K.6 of that specification. The quantization table is scaled by the compression quality before the table is applied to data during the compression process.

Because JPEG-B mode compression is an abbreviated format, the quantization and Huffman tables (which are required for decoding) are not included in the JPEG-B compressed data. These tables are included in JPEG-F compressed data.

The JPEG-B abbreviated format provides better compression than the JPEG-F format, and thus significantly reduces the storage space required if a large GeoRaster object is blocked into many smaller blocks. For example, for a remote sensing image compressed with a quality of 75, the average JPEG-B compression ratio might be about 20:1, while the average JPEG-F compression ratio might be about 2.5:1.

Both JPEG-B and JPEG-F are lossy compression formats. You can control the degree of loss with the quality keyword to the storageParam parameter. The quality keyword takes an integer value from 0 to 100. A value of 0 (zero) provides maximum compression, but causes substantial loss of data. A value of 75 (the GeoRaster default) provides an image that most people perceive as having no loss of quality, but that provides significant compression. A value of 100 provides the least compression, but the best quality.

1.8.2 DEFLATE Compression of GeoRaster Objects

DEFLATE compression compresses objects according to the Deflate Compressed Data Format Specification (Network Working Group RFC 1951), and it stores the compressed data in ZLIB format, as described in the ZLIB Compressed Data Format Specification (Network Working Group RFC 1950). The ZLIB header and checksum fields are included in the compressed GeoRaster object.

Although DEFLATE compression is supported for GeoRaster objects of any size, the total size (columnsPerBlock * rowsPerBlock * bandsPerBlock * cellDepth / 8) of each block of the GeoRaster object must not exceed 1 gigabyte (GB). For large GeoRaster objects, you can call the SDO_GEOR.changeFormatCopy procedure to block the GeoRaster object into blocks smaller than1 GB, and then compress the GeoRaster object; or you can perform the blocking and compression in the same call to the SDO_GEOR.changeFormatCopy procedure.

Because DEFLATE compression is lossless, compression quality does not apply, and is ignored if it is specified.

1.8.3 Decompression of GeoRaster Objects

You can decompress a compressed GeoRaster object in the database by specifying compression=NONE in the storageParam parameter. In this case, compression quality (if applicable) is derived from the metadata for JPEG-B compression or from the header data for JPEG-F compression; you should not specify compression quality as a storage parameter.

You can decompress a compressed GeoRaster object outside the database (that is, on the client side) by using an existing application programming interface (API), such as PL/SQL or the Oracle Call Interface (OCI), to retrieve the BLOB objects corresponding to the GeoRaster object's blocks, and decoding each compressed block individually according to the specifications of the relevant compression format. For example, if a GeoRaster object is compressed in JPEG-F mode, the decoding process should first parse the JPEG headers to retrieve the tables and block dimensions, and then apply Huffman decoding and dequantization to the image data.

Implementing JPEG decompression completely on your own is a complex, detail-oriented process. Depending on the application, it may be better to use an existing implementation. Libraries such as jpeglib in C and several imaging APIs in Java (for example, Sun Microsystems J2SE and JAI) already implement JPEG decompression, and you can adapt them to perform the decoding process on JPEG-compressed GeoRaster objects. You can apply essentially the same approach for DEFLATE compression using a ZLIB C library or Java API.

1.9 GeoRaster PL/SQL Subprogram Categories

GeoRaster provides the SDO_GEOR and SDO_GEOR_UTL PL/SQL packages, which contain subprograms (functions and procedures) to work with GeoRaster data and metadata. This section groups the subprograms into categories based on the types of actions they perform.

Chapter 4 and Chapter 5 contain detailed reference information about the subprograms in the SDO_GEOR and SDO_GEOR_UTL packages, respectively. The subprograms are presented in alphabetical order in those chapters.

1.9.1 Subprograms to Create, Load, and Export GeoRaster Data

Table 1-2 lists subprograms for creating, loading, and exporting GeoRaster data.

Table 1-2 Subprograms to Create, Load, and Export GeoRaster Data

Subprogram Description

SDO_GEOR.init

Initializes an empty GeoRaster object, which will be registered by GeoRaster in the xxx_SDO_GEOR_SYSDATA views.

SDO_GEOR.createBlank

Creates a blank GeoRaster object, in which all cells have the same value.

SDO_GEOR.copy

Makes a copy of an existing GeoRaster object.

SDO_GEOR.importFrom

Imports an image file or BLOB object into a GeoRaster object stored in the database.

SDO_GEOR.exportTo

Exports a GeoRaster object or a subset of a GeoRaster object to a file or to a BLOB object.


1.9.2 Subprograms to Validate and Process GeoRaster Objects

Table 1-3 lists subprograms for validating and processing GeoRaster objects.

Table 1-3 Subprograms to Validate and Process GeoRaster Objects

Subprogram Description

SDO_GEOR.validateGeoraster

Validates a GeoRaster object.

SDO_GEOR.schemaValidate

Validates a GeoRaster object's metadata against the GeoRaster XML schema.

SDO_GEOR.generateSpatialExtent

Generates a Spatial geometry that contains the spatial extent of the GeoRaster object.

SDO_GEOR.generatePyramid

Generates pyramid data for a GeoRaster object, which is stored together with the original data.

SDO_GEOR.deletePyramid

Deletes the pyramid data of a GeoRaster object.

SDO_GEOR.subset

Performs either or both of the following operations: (1) spatial crop, cut, or clip, or (2) layer or band subset.

SDO_GEOR.scale (deprecated)

Scales a GeoRaster object by enlarging or reducing the image along row and column dimensions.

SDO_GEOR.scaleCopy

Scales a GeoRaster object by enlarging or reducing the image along row and column dimensions, and puts the result into a new object that reflects the scaling.

SDO_GEOR.changeFormat (deprecated)

Changes the storage format of an existing GeoRaster object (for example, changing the blocking, cell depth, or interleaving).

SDO_GEOR.changeFormatCopy

Makes a copy of an existing GeoRaster object using a different storage format (for example, changing the blocking, cell depth, or interleaving).

SDO_GEOR.georeference

Georeferences a GeoRaster object using specified cell-to-model transformation coefficients.

SDO_GEOR.mosaic

Mosaics GeoRaster objects into one GeoRaster object.


1.9.3 Subprograms to Get and Set GeoRaster Metadata and Data

Many functions, most of whose names start with get, return metadata information about GeoRaster objects (and sometimes cell or pixel values). These functions can be further divided into subcategories according to the kind of metadata or data each retrieves related to each of the following:

  • Whole object

  • Cell coordinates and values

  • Cell metadata

  • Spatial reference system

  • Date and time the data was collected

  • Imagery band spectral information

  • Layers

  • Pyramids

For many of the get functions, there is a corresponding procedure, whose name starts with set, to set, modify, or delete the value of a metadata attribute. For most set procedures, to delete the value of the metadata attribute that the procedure is designed to modify, specify a null value for the attribute. For example, to delete the bin table for a layer of a GeoRaster object, call the SDO_GEOR.setBinTable procedure and specify a null tableName parameter. However, in most cases you cannot specify a null value for other related attributes. For example, you cannot specify a null layerNumber parameter in a call to the SDO_GEOR.setBinTable procedure.

GeoRaster automatically validates the GeoRaster object after any set procedure completes.

Note:

Most GeoRaster metadata can also be retrieved and changed using XMLType PL/SQL interfaces, such as existsNode and extract. However, if a GeoRaster get or set subprogram exists for the metadata attribute you want to retrieve or change, use the GeoRaster subprogram instead of an XMLType interface, because the GeoRaster subprograms validate any changes before they are made.

Table 1-4 lists subprograms for getting and setting information about the whole GeoRaster object.

Table 1-4 Subprograms to Get and Set Whole Object Metadata

Subprogram Description

SDO_GEOR.getID

Returns the user-defined identifier value associated with a GeoRaster object.

SDO_GEOR.setID

Sets a user-defined identifier to be associated with a GeoRaster object, or deletes the existing value if you specify a null id parameter.

SDO_GEOR.getVersion

Returns the user-specified version of a GeoRaster object.

SDO_GEOR.setVersion

Sets the user-specified version of a GeoRaster object.

SDO_GEOR.setRasterType

Sets the raster type of a GeoRaster object.

SDO_GEOR.isSpatialReferenced

Returns TRUE if the GeoRaster object is spatially referenced, or FALSE if the GeoRaster object is not spatially referenced.

SDO_GEOR.setSpatialReferenced

Specifies whether or not a GeoRaster object is spatially referenced, or deletes the existing value if you specify a null isReferenced parameter.

SDO_GEOR.isBlank

Returns TRUE if the GeoRaster object is a blank GeoRaster object, or FALSE if the GeoRaster object is not a blank GeoRaster object.

SDO_GEOR.getBlankCellValue

Returns the cell value to be used for all cells if a specified GeoRaster image is a blank GeoRaster object.

SDO_GEOR.setBlankCellValue

Sets the cell value to be used for all cells if a specified GeoRaster object is a blank GeoRaster object.

SDO_GEOR.getDefaultColorLayer

Returns the default numbers of the layers to be used for the red, green, and blue color components, respectively, for displaying a GeoRaster object.

SDO_GEOR.setDefaultColorLayer

Sets the default numbers of the layers to be used for the red, green, and blue color components, respectively, for displaying a GeoRaster object, or deletes the existing values if you specify a null defaultRGB parameter.

SDO_GEOR.getDefaultRed

Returns the number of the layer to be used for the red color component (in the RGB color space) for displaying a GeoRaster object.

SDO_GEOR.setDefaultRed

Sets the number of the layer to be used for the red color component (in the RGB color space) for displaying a GeoRaster object, or deletes the existing value if you specify a null defaultRed parameter.

SDO_GEOR.getDefaultGreen

Returns the number of the layer to be used for the green color component (in the RGB color space) for displaying a GeoRaster object.

SDO_GEOR.setDefaultGreen

Sets the number of the layer to be used for the green color component (in the RGB color space) for displaying a GeoRaster object, or deletes the existing value if you specify a null defaultGreen parameter.

SDO_GEOR.getDefaultBlue

Returns the number of the layer to be used for the blue color component (in the RGB color space) for displaying a GeoRaster object.

SDO_GEOR.setDefaultBlue

Sets the number of the layer to be used for the blue color component (in the RGB color space) for displaying a GeoRaster object, or deletes the existing value if you specify a null defaultBlue parameter.

SDO_GEOR.getInterleavingType

Returns the interleaving type for a GeoRaster object.

SDO_GEOR.getSpatialDimNumber

Returns the number of spatial dimensions of a GeoRaster object.

SDO_GEOR.getSpatialDimSizes

Returns the number of cells in each spatial dimension of a GeoRaster object.

SDO_GEOR.getBandDimSize

Returns the number of bands in a GeoRaster object.

SDO_GEOR.getLayerDimension

Returns the dimension that is mapped as the logical layer dimension of a GeoRaster object.

SDO_GEOR.getTotalLayerNumber

Returns the total number of layers in a GeoRaster object.


Table 1-5 lists subprograms for getting and setting information about cell coordinates and values.

Table 1-5 Subprograms to Get and Set Cell Coordinates and Values

Subprogram Description

SDO_GEOR.getModelCoordinate

Returns the coordinates in the model (ground) coordinate system associated with the point at the specified cell (raster) coordinates.

SDO_GEOR.getCellCoordinate

Returns the coordinates in the cell (raster) coordinate system associated with the point at the specified model (ground) coordinates.

SDO_GEOR.getCellValue

Returns the value of a single cell located anywhere in the GeoRaster object by specifying its row, column, and band number in its cell coordinate system, or by specifying a point geometry in its model coordinate system and its logical layer number.

SDO_GEOR.changeCellValue

Changes the value of raster data cells in a specified window of a GeoRaster object.

SDO_GEOR.getRasterSubset

Creates a single BLOB object containing all cells of a specified pyramid level that are inside or on the boundary of a specified window.

SDO_GEOR.getRasterBlocks

Returns an object of the SDO_RASTERSET collection type that identifies all blocks of a specified pyramid level that have any spatial interaction with a specified window.

SDO_GEOR.getRasterData

Creates a single BLOB object that contains all raster data of the input GeoRaster object at the specified pyramid level.

SDO_GEOR.getCellDepth

Returns the cell depth in bits.

SDO_GEOR.getNODATA

Returns the value representing NODATA cells in a GeoRaster object.

SDO_GEOR.getULTCoordinate

Returns the cell coordinates of the upper-left corner of a GeoRaster object.

SDO_GEOR.setULTCoordinate

Sets the cell coordinate values of the upper-left corner of a GeoRaster object, or deletes the existing values if you specify a null ultCoord parameter.

SDO_GEOR.getCompressionType

Returns the compression type for a GeoRaster object.

SDO_GEOR.getBlockingType

Returns the blocking type for a GeoRaster object.

SDO_GEOR.getBlockSize

Returns the number of cells for each dimension in each block of a GeoRaster object in an array showing the number of cells for each row, column, and (if relevant) band.


Table 1-6 lists subprograms for getting and setting information about the GeoRaster spatial reference system.

Table 1-6 Subprograms to Get and Set Spatial Reference System Metadata

Subprogram Description

SDO_GEOR.getSRS

Returns an object of type SDO_GEOR_SRS containing information related to the spatial referencing of a GeoRaster object.

SDO_GEOR.setSRS

Sets the spatial reference information of a GeoRaster object, or deletes the existing information if you specify a null srs parameter.

SDO_GEOR.isRectified

Returns TRUE if the GeoRaster object is identified as rectified, or FALSE if the GeoRaster object is not identified as rectified.

SDO_GEOR.setRectified

Specifies whether or not a GeoRaster object is rectified, or deletes the existing value if you specify a null isRectified parameter.

SDO_GEOR.isOrthoRectified

Returns TRUE if the GeoRaster object is identified as orthorectified, or FALSE if the GeoRaster object is not identified as orthorectified.

SDO_GEOR.setOrthoRectified

Specifies whether or not a GeoRaster object is orthorectified, or deletes the existing value if you specify a null isOrthoRectified parameter.

SDO_GEOR.getModelSRID

Returns the coordinate system (SDO_SRID value) associated with the model (ground) space for a GeoRaster object.

SDO_GEOR.setModelSRID

Sets the coordinate system (SDO_SRID value) for the model (ground) space for a GeoRaster object, or deletes the existing value if you specify a null srid parameter.

SDO_GEOR.getSpatialResolutions

Returns the spatial resolution value along each spatial dimension of a GeoRaster object.

SDO_GEOR.setSpatialResolutions

Sets the spatial resolution value along each spatial dimension of a GeoRaster object, or deletes the existing values if you specify a null resolutions parameter.


Table 1-7 lists subprograms for getting and setting information about the date and time that the GeoRaster data was collected.

Table 1-7 Subprograms to Get and Set Date and Time Metadata

Subprogram Description

SDO_GEOR.getBeginDateTime

Returns the beginning date and time for raster data collection in the metadata for a GeoRaster object.

SDO_GEOR.setBeginDateTime

Sets the beginning date and time for raster data collection in the metadata for a GeoRaster object, or deletes the existing value if you specify a null beginTime parameter.

SDO_GEOR.getEndDateTime

Returns the ending date and time for raster data collection in the metadata for a GeoRaster object.

SDO_GEOR.setEndDateTime

Sets the ending date and time for raster data collection in the metadata for a GeoRaster object, or deletes the existing value if you specify a null endTime parameter.


Table 1-8 lists subprograms for getting and setting information about the imagery band reference system.

Table 1-8 Subprograms to Get and Set Imagery Band System Metadata

Subprogram Description

SDO_GEOR.getSpectralResolution

Returns the spectral resolution of a GeoRaster object if it is a hyperspectral or multiband image.

SDO_GEOR.setSpectralResolution

Sets the spectral resolution of a GeoRaster object if it is a hyperspectral or multiband image, or deletes the existing value if you specify a null resolution parameter.

SDO_GEOR.getSpectralUnit

Returns the unit of measurement for identifying the wavelength interval for a band.

SDO_GEOR.setSpectralUnit

Sets the unit of measurement for identifying the wavelength interval for a band, or deletes the existing value if you specify a null unit parameter.


Table 1-9 lists subprograms for getting and setting information about layers (or bands).

Table 1-9 Subprograms to Get and Set Layer Metadata

Subprogram Description

SDO_GEOR.getScaling

Returns the coefficients of the scaling function for a layer of a GeoRaster object.

SDO_GEOR.setScaling

Sets the scaling function associated with a layer, or deletes the existing value if you specify a null scalingFunc parameter.

SDO_GEOR.getBinTable

Returns the name of the bin table associated with a layer.

SDO_GEOR.setBinTable

Sets the name of the bin table associated with a layer, or deletes the existing value if you specify a null tableName parameter.

SDO_GEOR.getBinType

Returns the bin type associated with a layer.

SDO_GEOR.getStatistics

Returns statistical data associated with a layer.

SDO_GEOR.setStatistics

Sets statistical data associated with a layer.

SDO_GEOR.getHistogram

Returns the histogram for a layer.

SDO_GEOR.getHistogramTable

Returns the histogram table for a layer.

SDO_GEOR.setHistogramTable

Sets the histogram table for a layer.

SDO_GEOR.hasGrayScale

Checks if a layer of a GeoRaster object has grayscale information.

SDO_GEOR.getGrayScale

Returns the grayscale mappings for a layer.

SDO_GEOR.getGrayScaleTable

Returns the grayscale mapping table for a layer.

SDO_GEOR.setGrayScale

Sets the grayscale mappings for a layer in a GeoRaster object, or deletes the existing values if you specify a null grayScale parameter.

SDO_GEOR.setGrayScaleTable

Sets the grayscale mapping table for a layer in a GeoRaster object, or deletes the existing value if you specify a null tableName parameter.

SDO_GEOR.hasPseudoColor

Checks if a layer has pseudocolor information.

SDO_GEOR.getColorMap

Returns the colormap for pseudocolor display of a layer.

SDO_GEOR.getColorMapTable

Returns the colormap table for pseudocolor display of a layer.

SDO_GEOR.setColorMap

Sets the colormap for a layer in a GeoRaster object, or deletes the existing value if you specify a null colorMap parameter.

SDO_GEOR.setColorMapTable

Sets the colormap table for a layer in a GeoRaster object, or deletes the existing value if you specify a null tableName parameter.

SDO_GEOR.getVAT

Returns the name of the value attribute table (VAT) associated with a layer.

SDO_GEOR.setVAT

Sets the name of the value attribute table (VAT) associated with a layer of a GeoRaster object, or deletes the existing value if you specify a null vatName parameter.

SDO_GEOR.getLayerOrdinate

Returns the band ordinate for a layer in a GeoRaster object.

SDO_GEOR.setLayerOrdinate

Sets the band ordinate value for a specified layer in a GeoRaster object, or deletes the existing value if you specify a null ordinate parameter.

SDO_GEOR.getLayerID

Returns the user-defined identifier value associated with a layer in a GeoRaster object.

SDO_GEOR.setLayerID

Sets a user-defined identifier to be associated with a layer in a GeoRaster object, or deletes the existing value if you specify a null id parameter.


Table 1-10 lists subprograms for getting information about pyramids.

Table 1-10 Subprograms to Get Pyramid Metadata

Subprogram Description

SDO_GEOR.getPyramidType

Returns the pyramid type for a GeoRaster object.

SDO_GEOR.getPyramidMaxLevel

Returns the level number of the top pyramid of a GeoRaster object.


1.9.4 Utility Subprograms

Table 1-11 lists the utility subprograms in the SDO_GEOR_UTL package.

Table 1-11 Subprogram for GeoRaster Triggers

Subprogram Description

SDO_GEOR_UTL.createDMLTrigger

Creates the standard GeoRaster data manipulation language (DML) trigger on a GeoRaster column in a GeoRaster table, so that the appropriate operations are performed when its associated trigger is fired. (For information about using triggers with GeoRaster, see Section 3.1.1.)

SDO_GEOR_UTL.makeRDTNamesUnique

Renames all existing raster data tables that do not have unique names so that all names are unique, and updates the GeoRaster system data and all affected GeoRaster objects to reflect the new names.

SDO_GEOR_UTL.renameRDT

Renames one or more existing raster data tables, and updates the GeoRaster system data and all affected GeoRaster objects to reflect the new names.


1.10 GeoRaster Tools: Viewer, Loader, Exporter

GeoRaster includes several client-side tools. If you installed the demo files from the Companion CD, these tools are in the following directory (assuming the default Spatial installation directory of $ORACLE_HOME/md):

$ORACLE_HOME/md/demos/georaster/java

This directory contains a file named README, which includes helpful usage information, as well as instructions for using the following tools:

  • GeoRaster viewer, which displays GeoRaster objects and metadata, as well as raster images, in a Java viewer application. You can connect to multiple databases simultaneously, and see the GeoRaster objects from each database listed in the left pane. You can quickly switch among views at various resolutions, from the original image (pyramid level 0) to the overview (highest pyramid level). You can perform image enhancement, such as linear stretch (automatic, manual, or piecewise), normalization, equalization, and controls for brightness, contrast, and threshold. (For more information about viewing GeoRaster objects, see Section 3.14.)

    In the viewer, you can call the GeoRaster loader and exporter tools, thus enabling you to use a single tool as an interface to the capabilities of all the GeoRaster tools. The loader and exporter tools are described in this section and in the README file.

  • GeoRaster loader, which loads raster data into the GeoRaster objects. You can use this as an alternative to the SDO_GEOR.importFrom procedure, which is documented in Chapter 4. However, on non-Windows systems this loader tool does not support the BMP or GIF image formats, so you must use the SDO_GEOR.importFrom procedure with these formats on non-Windows systems. This tool does not support raster data that has a cell depth value of 2BIT, or source multiband raster data with BIL or BSQ interleaving types. The imported GeoRaster object has the BIP interleaving type. The loading operation of this tool cannot be rolled back.

    When an image in JPEG file format is loaded, the amount of memory required for the operation depends on the size of the uncompressed image, and can be specified as a command line parameter using the -Xmx option (for example, java -Xmx256M oracle.spatial.georaster.tools.GeoRasterLoader ...).

  • GeoRaster exporter, which exports GeoRaster objects to image files. You can use this as an alternative to the SDO_GEOR.exportTo procedure, which is documented in Chapter 4. The GeoRaster exporter tool does not support GIF as a destination file format; the SDO_GEOR.exportTo procedure does not support GIF or JPEG as a destination file format. The GeoRaster exporter tool does not support GeoRaster objects that have a cellDepth value of 2BIT. GeoRaster objects with a cell depth of 8 bits or greater that have a BSQ or BIL interleaving are exported in BIP interleaved format. For information about limits on the amount of GeoRaster data that can be exported in a single operation, see the Usage Notes for the SDO_GEOR.exportTo procedure.

These tools are developed in Java, so you can run them anywhere through an intranet or the Internet, as long as you establish a network connection with the Oracle database.

GeoRaster can load and export the following image formats: TIF/GeoTIFF, (georeferencing information), JPEG, BMP, GIF, and PNG. Georeferencing information can be loaded from and exported to ESRI world files, but georeferencing information in GeoTIFF imagery is ignored during loading and exporting. Some restrictions regarding image size and types may apply; see the README file for the GeoRaster tools.

After raster or image files are loaded into GeoRaster objects, the data is completely stored in the native GeoRaster object data type and is independent from any specific file formats.

If you want to create your own GeoRaster loader and exporter tools, you can develop them using OCI, Oracle C++ Call Interface (OCCI), or Java, and you can implement them as client-side commands or server-side SQL procedures or functions.

1.11 GeoRaster PL/SQL Demo Files

GeoRaster includes several PL/SQL demo files that show common operations. If you installed the demo files from the Companion CD, these files are in the following directory under the Spatial installation directory (which by default is $ORACLE_HOME/md):

/demo/georaster/plsql

The README file in that directory introduces the PL/SQL files in the directory, which are listed in Table 1-12.

Table 1-12 GeoRaster PL/SQL Demo Files

File Description

georaster_demo.sql

Master file that invokes each of the other files (in the sequence listed in this table).

create_georaster_table.sql

Creates a GeoRaster table, the DML trigger on the GeoRaster table, and some raster data tables.

import_georaster.sql

Initializes empty GeoRaster objects, and imports TIFF images into the GeoRaster objects.

generate_georaster.sql

Generates GeoRaster objects for use by the demo files.

validate_georaster.sql

Validates a column of GeoRaster objects, and validates a GeoRaster object against the GeoRaster metadata XML schema.

query_georaster.sql

Shows many query operations on GeoRaster metadata and data.

ccf_georaster.sql

Copies GeoRaster objects, with and without changes to the format.

subset_georaster.sql

Subsets (crops) GeoRaster objects.

scale_georaster.sql

Scales (enlarges or shrinks) GeoRaster objects.

pyramid_georaster.sql

Generates pyramids for a GeoRaster object and queries pyramid metadata.

drop_georaster_table.sql

Drops the GeoRaster table and the raster data tables.


1.12 README File for Spatial and Related Features

A README.txt file supplements the information in the following manuals: Oracle Spatial User's Guide and Reference, Oracle Spatial GeoRaster (this manual), and Oracle Spatial Topology and Network Data Models. This file is located at:

$ORACLE_HOME/md/doc/README.txt