Oracle8i Spatial User's Guide and Reference
Release 8.1.5

A67295-01

Library

Product

Contents

Index

Prev Next

10
The Relational Schema

Prior to 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 Open GIS Features for SQL Implementation options, namely, using numeric SQL types for geometry storage. This schema is different from the new 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 A.1, to using this model.

10.1 Database Structures for the Relational Implementation

The four tables, used to store and index geometry, are collectively referred to as a layer. A template SQL script is provided to facilitate the creation of these tables. See Section A.3.2, "crlayer.sql Script" for details.

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

Table 10-1 <layername>_SDOLAYER
SDO_ORDCNT  SDO_LEVEL  SDO_NUMTILES  SDO_MAXLEVEL1  SDO_COORDSYS2 

<number>  

<number>  

<number>  

<number>  

<varchar>  

1 SDO_MAXLEVEL is an optional column.
2 SDO_COORDSYS is an optional column.
Table 10-2 <layername>_SDODIM Table or View
SDO_DIMNUM   SDO_LB   SDO_UB   SDO_TOLERANCE   SDO_DIMNAME  
<number>   <number>   <number>   <number>   <varchar>  
Table 10-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 10-4 <layername>_SDOINDEX Table
SDO_GID   SDO_CODE   SDO_MAXCODE 1  SDO_GROUPCODE 2  SDO_META 
<number>   <raw>   <raw>   <raw>   <raw>  
1 SDO_MAXCODE is not required for the recommended fixed-size tile indexing algorithm.
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 10-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 10-1 Complex Polygon

<layername>_SDOLAYER

SDO_ORDCNT (number) 

4  

<layername>_SDODIM

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

1  

0  

100  

.05  

X axis  

2  

0  

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  

0  

3  

0  

P1(X)  

P1(Y)  

P2(X)  

P2(Y)  

1013  

0  

3  

1  

P2(X)  

P2(Y)  

P3(X)  

P3(Y)  

1013  

0  

3  

2  

P3(X)  

P3(Y)  

P4(X)  

P4(Y)  

1013  

0  

3  

3  

P4(X)  

P4(Y)  

P5(X)  

P5(Y)  

1013  

0  

3  

4  

P5(X)  

P5(Y)  

P6(X)  

P6(Y)  

1013  

0  

3  

5  

P6(X)  

P6(Y)  

P7(X)  

P7(Y)  

1013  

0  

3  

6  

P7(X)  

P7(Y)  

P8(X)  

P8(Y)  

1013  

0  

3  

7  

P8(X)  

P8(Y)  

P1(X)  

P1(Y)  

1013  

1  

3  

0  

G1(X)  

G1(Y)  

G2(X)  

G2(Y)  

1013  

1  

3  

1  

G2(X)  

G2(Y)  

G3(X)  

G3(Y)  

1013  

1  

3  

2  

G3(X)  

G3(Y)  

G4(X)  

G4(Y)  

1013  

1  

3  

3  

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-wide1 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 Section 1.6, "Indexing Methods". 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_CODEs. Each SDO_CODE value may be associated with one or more SDO_GIDs.


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 NULLs stored in the <layername>_SDOGEOM table.



Prev

Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index