1 GeoRaster Overview and Concepts

GeoRaster is a feature of Oracle Spatial that lets you store, index, query, analyze, and deliver GeoRaster data, that is, 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.

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.

1.1Vector 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 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 GeoRaster Targeted Data Sources and Uses

GeoRaster 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.1Remote 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.2Photogrammetry

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.3Geographic 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.4Cartography

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.5Digital 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.6Geology, 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.3GeoRaster 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.

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 (or, 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.)

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.

1.4GeoRaster 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:

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

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

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.

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.

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.

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.6.

Additional tables, such as ground control point (GCP) tables and value attribute tables (VATs), can be related to the GeoRaster objects. For more information about these additional related tables, see Section 2.4.6.

1.4.1Storage 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 1 or a positive power of 2 (2, 4, 8, 16, 32, 64, and so on). (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, and 64BIT_REAL. If cellDepth is not specified, the value from the source GeoRaster object is used by default. Example: celldepth=16BIT_U

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

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

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.

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.3Blank 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.5Bands, 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.

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.

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 GeoRaster object by calling the SDO_GEOR.changeFormat or SDO_GEOR.changeFormatCopy procedure, so that the data can be more efficiently processed and used.

1.6Georeferencing

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.

1.6.1GeoRaster 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 the image or in raster space.

col = Column index of the cell in the image or 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.

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:

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.7Pyramids

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-5shows 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.

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 smallest top-level pyramid is between 64 and 128. This decides the maximum reduced-resolution pyramid level, which is calculated as follows: (int)(log2(a / 64))

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 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.8.3 Subprogram for GeoRaster DML Triggers

Table 1-4 lists the subprogram for creating the standard GeoRaster trigger to fire after data manipulation language (DML) operations on a GeoRaster column in a GeoRaster table. (For information about using triggers with GeoRaster, see Section 3.1.) This subprogram is in the SDO_GEOR_UTL package.

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.

1.8.4Subprograms 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 a metadata attribute, 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.

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.

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.

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.

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.

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.

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.

1.9GeoRaster Tools: Loader, Viewer, Exporter

GeoRaster includes several client-side command line tools. If you selected the option to install demo files during the Oracle installation, these tools are in the following directory under the Spatial installation directory (which by default is $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 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.

GeoRaster viewer, which displays GeoRaster objects and metadata in a Java viewer application. For more information about viewing GeoRaster objects, see Section 3.11.

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.

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 these 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.10GeoRaster PL/SQL Demo Files

GeoRaster includes several PL/SQL demo files that show common operations. If you selected the option to install demo files during the Oracle installation, these files are in the following directory under the Spatial installation directory (which by default is $ORACLE_HOME/md):

/demos/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.