1.3 Topology Geometries and Layers

A topology geometry (also referred to as a feature) is a spatial representation of a real world object. For example, Main Street and Walden State Park might be the names of topology geometries.

The geometry is stored as a set of topological elements (nodes, edges, and faces), which are sometimes also referred to as primitives. Each topology geometry has a unique ID (assigned by Spatial when records are imported or loaded) associated with it.

A topology geometry layer consists of topology geometries, usually of a specific topology geometry type, although it can be a collection of multiple types (see Collection Layers for information about collection layers). For example, Streets might be the topology geometry layer that includes the Main Street topology geometry, and State Parks might be the topology geometry layer that includes the Walden State Park topology geometry. Each topology geometry layer has a unique ID (assigned by Spatial) associated with it. The data for each topology geometry layer is stored in a feature table. For example, a feature table named CITY_STREETS might contain information about all topology geometries (individual roads or streets) in the Streets topology geometry layer.

Each topology geometry (feature) is defined as an object of type SDO_TOPO_GEOMETRY (described in SDO_TOPO_GEOMETRY Type), which identifies the topology geometry type, topology geometry ID, topology geometry layer ID, and topology ID for the topology.

Topology metadata is automatically maintained by Spatial in the USER_SDO_TOPO_METADATA and ALL_SDO_TOPO_METADATA views, which are described in xxx_SDO_TOPO_METADATA Views. The USER_SDO_TOPO_INFO and ALL_SDO_TOPO_INFO views (described in xxx_SDO_TOPO_INFO Views) contain a subset of this topology metadata.

1.3.1 Features

Often, there are fewer features in a topology than there are topological elements (nodes, edges, and faces). For example, a road feature may consist of many edges, an area feature such as a park may consist of many faces, and some nodes may not be associated with point features. Figure 1-3 shows point, line, and area features associated with the topology that was shown in Figure 1-1 in Topology Data Model Concepts.

Figure 1-3 Features in a Topology

Description of Figure 1-3 follows
Description of "Figure 1-3 Features in a Topology"

Figure 1-3 shows the following kinds of features in the topology:

  • Point features (traffic signs), shown as dark circles: S1, S2, S3, and S4

  • Linear features (roads or streets), shown as dashed lines: R1, R2, R3, and R4

  • Area features (land parcels), shown as rectangles: P1, P2, P3, P4, and P5

    Land parcel P5 does not include the shaded area within its area. (Specifically, P5 includes face F1 but not face F9. These faces are shown in Figure 1-1 in Topology Data Model Concepts.)

Example 1-12 in Topology Built from Topology Data defines these features.

1.3.2 Collection Layers

A collection layer is a topology geometry layer that can contain topological elements of different topology geometry types. For example, using the CITY_DATA topology from the examples in Topology Examples (PL/SQL), you could create a collection layer to contain specific land parcel, city street, and traffic sign elements.

To create a collection layer, follow essentially the same steps for creating other types of layers. Create a feature table for the layer, as in the following example:

CREATE TABLE collected_features ( -- Selected heterogeneous features
  feature_name VARCHAR2(30) PRIMARY KEY,
  feature SDO_TOPO_GEOMETRY);

Associate the feature table with the topology, specifying COLLECTION for the topo_geometry_layer_type parameter in the call to the SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER procedure, as in the following example:

EXECUTE SDO_TOPO.ADD_TOPO_GEOMETRY_LAYER('CITY_DATA', COLLECTED_FEATURES', 'FEATURE', 'COLLECTION');

To load the feature table for the collection layer, insert the necessary rows, as shown in Example 1-1.

Example 1-1 Loading the Feature Table for a Collection Layer

-- Take R5 from the CITY_STREETS layer.
INSERT INTO collected_features VALUES(
  'C_R5',
  SDO_TOPO_GEOMETRY('CITY_DATA',
    2,  -- tg_type = line/multiline
    4,  -- tg_layer_id
    SDO_TOPO_OBJECT_ARRAY(
      SDO_TOPO_OBJECT(20, 2),
      SDO_TOPO_OBJECT(-9, 2)))
);
 
-- Take S3 from the TRAFFIC_SIGNS layer.
INSERT INTO collected_features VALUES(
  'C_S3',
  SDO_TOPO_GEOMETRY('CITY_DATA',
    1,  -- tg_type = point/multipoint 
    4,  -- topo layer id
    SDO_TOPO_OBJECT_ARRAY(
       SDO_TOPO_OBJECT(6, 1)))
);
 
-- Take P3 from the LAND_PARCELS layer.
INSERT INTO collected_features VALUES(
  'C_P3',
  SDO_TOPO_GEOMETRY('CITY_DATA',
    3,  -- tg_type = (multi)polygon
    4,
    SDO_TOPO_OBJECT_ARRAY(
      SDO_TOPO_OBJECT(5, 3),
      SDO_TOPO_OBJECT(8, 3)))
);
 
-- Create a collection from a polygon and a point.
INSERT INTO collected_features VALUES(
  'C1',
  SDO_TOPO_GEOMETRY('CITY_DATA',
    4,  -- tg_type = collection
    4,
    SDO_TOPO_OBJECT_ARRAY(
      SDO_TOPO_OBJECT(5, 3),
      SDO_TOPO_OBJECT(6, 1)))
);
 
-- Create a collection from a polygon and a line.
INSERT INTO collected_features VALUES(
  'C2',
  SDO_TOPO_GEOMETRY('CITY_DATA',
    4,  -- tg_type = collection
    4,
    SDO_TOPO_OBJECT_ARRAY(
      SDO_TOPO_OBJECT(8, 3),
      SDO_TOPO_OBJECT(10, 2)))
);
                  
-- Create a collection from a line and a point.
INSERT INTO collected_features VALUES(
  'C3',
  SDO_TOPO_GEOMETRY('CITY_DATA',
     4,  -- tg_type = collection
     4,
     SDO_TOPO_OBJECT_ARRAY(
       SDO_TOPO_OBJECT(-5, 2),
       SDO_TOPO_OBJECT(10, 1)))
);