Oracle Spatial User's Guide and Reference
Release 8.1.7

Part Number A85337-01

Library

Product

Contents

Index

Go to previous page Go to next page

12
The Relational Schema

Before release 8.1, the Spatial product always used four database tables to store and index spatial data. This database structure is modeled on the first of three OpenGIS Features for SQL Implementation options, namely, using numeric SQL types for geometry storage. This schema is different from the spatial objects model introduced in Spatial release 8.1 and described in Part II of this guide. However, there are still some advantages, discussed in Section 1.2.2, to using this model.

.


Note:

In the next release of Oracle Spatial, the relational model will no longer be documented in this guide, but will instead be documented in a separate document whose title and location will be announced.

Spatial applications using the relational model will continue to work; however, if you are not already using the object-relational model for all Spatial applications, you are encouraged to do so before the next release. 


12.1 Database Structures for the Relational Implementation

The four tables, used to store and index geometries, are collectively referred to as a layer. A template SQL script is provided to facilitate the creation of these tables. See Section A.2.2 for details.

Table 12-1 through Table 12-4 describe the schema of a Spatial layer.

Table 12-1 <layername>_SDOLAYER Table
SDO_ORDCNT  SDO_LEVEL  SDO_NUMTILES  SDO_MAXLEVELFoot 1  SDO_COORDSYSFoot 2 

<number> 

<number> 

<number> 

<number> 

<varchar> 

Foot 1 SDO_MAXLEVEL is an optional column.
Foot 2 SDO_COORDSYS is an optional column.
Table 12-2 <layername>_SDODIM Table or View
SDO_DIMNUM   SDO_LB   SDO_UB   SDO_TOLERANCE   SDO_DIMNAME  
<number>  <number>  <number>  <number>  <varchar> 
Table 12-3 <layername>_SDOGEOM Table or View
SDO_GID   SDO_ESEQ   SDO_ETYPE   SDO_SEQ   SDO_X1   SDO_Y1   ...   SDO_Xn   SDO_Yn  
<number>  <number>  <number>  <number>  <number>  <number>  ...  <number>  <number> 
Table 12-4 <layername>_SDOINDEX Table
SDO_GID   SDO_CODE   SDO_MAXCODE Foot 1  SDO_GROUPCODE Foot 2  SDO_META 
<number>  <raw>  <raw>  <raw>  <raw> 
Foot 1 SDO_MAXCODE is not required for the recommended fixed-size tile indexing algorithm.
Foot 2 SDO_GROUPCODE is not required for the recommended fixed-size tile indexing algorithm.

The columns of each table are defined as follows:

<layername>_SDOLAYER

<layername>_SDODIM

<layername>_SDOGEOM

<layername>_SDOINDEX

Spatial provides stored procedures that assume the existence of the layer schema as described in this section. While layer tables may contain additional columns, they are required to contain at least the columns described in this section with the same column names and data types.

Figure 12-1 illustrates how a geometry is stored in the database using Spatial and the OGIS V1 schema model. The geometry to be stored is a complex polygon with a hole in it.

Figure 12-1 Complex Polygon


Illustration of complex polygon.

<layername>_SDOLAYER

SDO_ORDCNT (number) 

<layername>_SDODIM

SDO_DIMNUM (number)  SDO_LB (number)  SDO_UB (number)  SDO_TOLERANCE (number)  SDO_DIMNAME (varchar) 

100 

.05 

X axis 

100 

.05 

Y axis 

<layername>_SDOGEOM

SDO_GID (number)  SDO_ESEQ (number)  SDO_ETYPE (number)  SDO_SEQ (number)  SDO_X1 (number)  SDO_Y1 (number)  SDO_X2 (number)  SDO_Y2 (number) 

1013 

P1(X) 

P1(Y) 

P2(X) 

P2(Y) 

1013 

P2(X) 

P2(Y) 

P3(X) 

P3(Y) 

1013 

P3(X) 

P3(Y) 

P4(X) 

P4(Y) 

1013 

P4(X) 

P4(Y) 

P5(X) 

P5(Y) 

1013 

P5(X) 

P5(Y) 

P6(X) 

P6(Y) 

1013 

P6(X) 

P6(Y) 

P7(X) 

P7(Y) 

1013 

P7(X) 

P7(Y) 

P8(X) 

P8(Y) 

1013 

P8(X) 

P8(Y) 

P1(X) 

P1(Y) 

1013 

G1(X) 

G1(Y) 

G2(X) 

G2(Y) 

1013 

G2(X) 

G2(Y) 

G3(X) 

G3(Y) 

1013 

G3(X) 

G3(Y) 

G4(X) 

G4(Y) 

1013 

G4(X) 

G4(Y) 

G1(X) 

G1(Y) 

In this example, the <layername>_SDOGEOM table is shown as an 8-column table with 4 ordinates per row. In actual usage, Spatial supports n-wideFoot 1 tables. The coordinates for the outer polygon in this example could have been loaded into a single row containing values for coordinates P1 to P8, and then repeating P1 to close the polygon. The coordinates would be stored in the SDO_X1 and SDO_Y1 through SDO_X9 and SDO_Y9 columns.

The data in the <layername>_SDOINDEX table is described in further detail in Section 1.7. The SDOINDEX table contains entries of the form [SDO_GID, SDO_CODE] where each SDO_CODE represents a tile that interacts with a geometry identified by SDO_GID. For a given SDO_GID value, there may be one or more SDO_CODE values. Each SDO_CODE value may be associated with one or more SDO_GID values.


Foot 1 A <layername>_SDOGEOM table can have up to 1000 columns. The maximum number of data columns is 1000, minus 4 for the other required spatial columns, and minus any other user-defined columns. For polygons and line strings, storing 16 to 20 ordinates per row is suggested for performance reasons, but not required. The objective is to minimize the number of null values stored in the <layername>_SDOGEOM table.


Go to previous page Go to next page
Oracle
Copyright © 1996-2000, Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index