Spatial tables

A spatial table is a table that includes one or more spatial columns.

When you create a spatial table, you specify the following information:

  • The name of the table.
  • The first column must be named se_row_id and have a type of INTEGER. The se_row_id column is required by the ESRI client software to be the unique key of the spatial table. The se_row_id column stores the SRID that you want to use for the spatial data.
  • One column must have a spatial data type. A spatial column can accept only data of the type required by the spatial column. For example, a column of ST_Polygon type rejects integers, characters, and even other types of geometry.
  • You can have any other columns that you need.
  • You can specify an sbspace in which to store spatial data. Use the PUT clause to specify spatial column and the sbspace.

Examples

The sensitive areas and hazardous waste sites example illustrates two spatial tables.

Stored in the sensitive_areas table are schools, hospitals, and playgrounds. The ST_Polygon data type is used to store the sensitive areas:
CREATE TABLE sensitive_areas (se_row_id integer NOT NULL,
                              area_id   integer,
                              name      varchar(128),
                              size      float,
                              type      varchar(10),
                              zone      ST_Polygon);

The hazardous_sites table holds locations of hazardous waste sites. The hazardous sites are stored as points using the ST_Point type. The ST_Point data is stored in the sbspace that is named mysbspace:

CREATE TABLE hazardous_sites (se_row_id integer NOT NULL,
                              site_id   integer,
                              name      varchar(40),
                              location  ST_Point)
       PUT location in mysbspace;