Oracle8(TM) Server Spatial Cartridge User's Guide and Reference
Release 8.0.3

A53264_01

Library

Product

Contents

Index

Prev Next

1
Spatial Cartridge Concepts

Oracle8 Spatial Cartridge is an integrated set of functions and procedures that enables spatial data to be stored, accessed, and analyzed quickly and efficiently in an Oracle8 database.

Spatial data represents the essential location characteristics of real or conceptual objects as those objects relate to the real or conceptual space in which they exist.

1.1 Introduction to Spatial Data

Spatial Cartridge is designed to make the storage, retrieval, and manipulation of spatial data easier and more natural to users such as a Geographic Information System (GIS). Once this data is stored in an Oracle8 relational database, it can be easily and meaningfully manipulated and retrieved as it relates to all the other data stored in the database.

A common example of spatial data can be seen in a road map. A road map is a two-dimensional object that contains points, lines, and polygons that can represent cities, roads, and political boundaries such as states or provinces. A road map is a visualization of geographic information. The location of cities, roads, and political boundaries that exist on the surface of the Earth are projected onto a two-dimensional display or piece of paper, preserving the relative positions and relative distances of the rendered objects.

The data that indicates the Earth location (latitude and longitude, or height and depth) of these rendered objects is the spatial data. When the map is rendered, this spatial data is used to project the locations of the objects on a two-dimensional piece of paper. A GIS is often used to store, retrieve, and render this Earth-relative spatial data.

Other types of spatial data that can be stored using Spatial Cartridge besides GIS data include data from computer-aided design (CAD) and computer-aided manufacturing (CAM) systems. Instead of operating on objects on a geographic scale, CAD/CAM systems work on a smaller scale such as for an automobile engine or much smaller scale as for printed circuit boards.

The differences among these three systems are only in the scale of the data, not its complexity. They might all actually involve the same number of data points. On a geographic scale, the location of a bridge can vary by a few tenths of an inch without causing any noticeable problems to the road builders. Whereas, if the diameter of an engine's pistons are off by a few tenths of an inch, the engine will not run. A printed circuit board is likely to have many thousands of objects etched on its surface that are no bigger than the smallest detail shown on a roadbuilder's blueprints.

1.2 Geometric Types

Spatial Cartridge supports three geometric primitive types and geometries composed of collections of these types. The three primitive types are:

2-D points are elements composed of two ordinates, X and Y, often corresponding to longitude and latitude. Line strings are composed of one or more pairs of points that define line segments. Polygons are composed of connected line strings that form a closed ring and the interior of the polygon is implied. Figure 1-1 illustrates the supported geometric primitives:

Figure 1-1 Geometric Primitives

Self-crossing polygons are not supported although self-crossing line strings are. If a line string crosses itself it does not become a polygon. A self-crossing line string does not have any implied interior.

1.3 Data Model

The Spatial Cartridge data model is a hierarchical structure consisting of elements, geometries, and layers, which correspond to representations of spatial data. Layers are composed of geometries, which in turn are made up of elements.

For example, a point might represent a building location, a line string might be a road or flight path, and a polygon could be a state, city, zoning district, or city block.

1.3.1 Element

An element is the basic building block of a geometric feature for Spatial Cartridge. The supported spatial element types are points, line strings, and polygons. For example, elements might model star constellations (point clusters), roads (line strings), and county boundaries (polygons). Each coordinate in an element is stored as an X,Y pair.

Point data1 consists of one coordinate. Line data consists of two coordinates representing a line segment of the element. Polygon data consists of coordinate pair values, one vertex pair for each line segment of the polygon. Coordinates are defined in either a clockwise or counter-clockwise order around the polygon. Each layer's geometric objects and their associated spatial index are stored in the database in tables.

If an element spans more than one row, an incremental sequence number (starting at zero) orders the rows.

1.3.2 Geometry

A geometry, or geometric object, is the representation of a user's spatial feature, modeled as an ordered set of primitive elements. Each geometric object is required to be uniquely identified by a numeric geometry identifier (GID), associating the object with its corresponding attribute set.

A complex geometric feature such as a polygon with holes would be stored as a sequence of polygon elements. In a multi-element polygonal geometry, all subelements are wholly contained within the outermost element, thus building a more complex geometry from simpler pieces.

For example, a geometry might describe the buildable land in a town. This could be represented as a polygon with holes where water or zoning prevents construction.

1.3.3 Layer

A layer is a heterogeneous collection of geometries having the same attribute set. For example, one layer in a GIS might include topographical features, while another describes population density, and a third describes the network of roads and bridges in the area (lines and points).

1.4 Database Structures

Spatial Cartridge uses four database tables to store and index spatial data. These four tables are collectively referred to as a "layer". A template SQL script is provided to facilitate the creation of these tables. See Section A.3, "crlayer.sql Script" for details.

Figure 1-2 describes the schema of a Spatial Cartridge layer.

Figure 1-2 Spatial Table Structure

The columns of each table are defined as follows:

<layername>_SDOLAYER:

<layername>_SDODIM:

<layername>_SDOGEOM:

<layername>_SDOINDEX:

Spatial Cartridge provides stored procedures that assume the existence of the layer schema as described in this section. While layer objects may contain additional columns, they are required to contain at least the columns described here with the same column names and data types. The SDO_GID column always needs to be specified when loading or inserting geometries.

Figure 1-3 illustrates how a geometry is stored in the database using Spatial Cartridge. The geometry to be stored is a complex polygon with a hole in it.

Figure 1-3 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(X)  

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 a 4-wide table. In actual usage, Spatial Cartridge supports N-wide2 tables. The coordinates for each ESEQ in this example table could have been loaded into a single, 18-wide row containing values for SDO_X1 and SDO_Y1 through SDO_X9 and SDO_Y9.

The data in the <layername>_SDOINDEX table is described in Section 1.5, "Indexing Method".

1.5 Indexing Method

Spatial Cartridge uses HHCODEs to build a spatial index.

HHCODEs represent a quad tree decomposition of the object space and are used to define an exclusive and exhaustive cover of every element stored in a Spatial Cartridge layer. Such HHCODEs are sometimes referred to as "tiles." Spatial Cartridge can use either fixed or variable-sized tiles to cover a geometry.

The number of tiles used to cover an element is a user-tunable parameter. Using either smaller fixed-size tiles or more variable-sized tiles provides a better fit of the tiles to the element. The fewer the number of tiles or the larger the tiles, the coarser the fit. For primary filter operations, a small number of tiles should be used because it is more desirable to have less tiles to search.

The process of determining which tiles cover a given element is called tessellation. The results of a tessellation process on an element are stored in the <layername>_SDOINDEX table. See Section 2.3, "Index Creation" for more information on tessellation.

Figure 1-4 illustrates geometry 1013 decomposed to a maximum of four cover tiles. The cover tiles are then shown stored in the <layername>_SDOINDEX table.

Figure 1-4 Tessellated Figure

Only three of the four tiles generated by the first tessellation interact with the geometry. Tile T0 shows a further tessellation into four smaller tiles, two of which interact with the geometry. Only those tiles that interact with the geometry are stored in the <layername>_SDOINDEX table, as shown in Table 1-1. In this example, four variable-sized tiles are used.

With fixed-size tiling, size 1 would create the same three large cover tiles shown. Setting the size to 2 would cause two subdivisions, creating 8 cover tiles (the same two in Tile T0, four in T2, and two in T3) for this geometry.

Table 1-1 <layername>_SDOINDEXor Using Variable-Sized Tiles
SDO_GID <NUMBER>   SDO_CODE <RAW>   SDO_MAXCODE <RAW>  

1013  

T0_02  

T0_02FF...F  

1013  

T0_03  

T0_03FF...F  

1013  

T2  

T2FF...F  

1013  

T3  

T3FF...F  

1013  

T2  

T2FF...F  

All elements in a geometry are tessellated. In a multi-element polygon like 1013, Element 1 is covered by redundant tiles from the tessellation of Element 0.

1.6 Partitioned Point Data

Spatial Cartridge has undergone an architectural change for this release. A reliance on partitioned tables has changed to utilize improved spatial indexing capable of handling complex geometries. However, for handling very large amounts (tens of gigabytes) of purely point data, keeping that data in partitioned tables may be more efficient than using the new spatial indexing scheme.

Table partitioning and spatial indexing are two very different techniques. While both are important to their respective users, this manual emphasizes the spatial indexing capabilities of Spatial Cartridge.

See Chapter 4, "Partitioned Point Data" for a brief overview of partitioned point data.


1 Point data can also be stored in a partitioned table. See Chapter 4, "Partitioned Point Data" for details.

2 A <layername>_SDOGEOM table can have up to 255 columns. The maximum number of data columns is 255, minus 4 for the other required spatial attributes, and minus any other user-defined columns.



Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index