Getting started

Storing geometry in a relational database

Standards have been developed by industry, government bodies, and the ISO for managing geometric objects in a relational database. These standards include:

OpenGIS Consortium - Simple Features Specification for SQL

ISO19125-1, Geographic Information - Simple feature access - Part 1: Common architecture

ISO19125-2, Geographic Information - Simple feature access - Part 2: SQL option

ISO 19107, Geographic information - Spatial schema

ISO 13249-3, Information technology Database languages SQL Multimedia and Application Packages Part 3: Spatial.  

Taken together, these standards define the behavior of the geometric object, well-known exchange formats for the geometric object, and three different schemas for storing the geometric object as a value in a relational database. The different storage schemas are:

These different storage schema are defined in abstract form by the standards organizations, and may take advantage of DBMS specific data types. For example, the Binary storage schema may be implemented using any DBMS supported binary data type, and the specification defines the binary type in the abstract.

ArcSDE manages the physical storage of geometry for features using standard data types provided by the host DBMS. Some DBMS' have spatial data types, while others provide standard binary or binary large object (BLOB) storage types. ArcSDE geometry storage is dependent on the capabilities of your DBMS. No matter what geometry storage type you use, an ArcSDE client application does not need to know what the geometry storage type is. In the case of Oracle, you can use any combination of available storage methods. You may choose to store a point layer as Oracle Spatial geometry types and a polygon layer as binary. The decision on how to store your geometry will be based on the DBMS you use and other requirements specific to your implementation.

The Configuration and Tuning Guides for each DBMS describe how to define geometry storage types offered by the DBMS. The ESRI product documentation folder contains a pdf file, config_tuning_guide_[your DBMS].pdf  

This table summarizes the DBMS and geometry storage options available.

DBMS

GEOMETRY STORAGE

COLUMN TYPE

IBM DB2

Spatial Extender - Geometry Type

ST_Geometry*

Informix

Spatial DataBlade - Geometry Type

ST_Geometry*

Microsoft SQL Server

Binary Schema

Image

Oracle

Binary Schema

Long Raw

 

Binary Schema

Blob

 

Oracle Spatial - Geometry Type

SDO_GEOMETRY

*ST_GEOMETRY is a super class of several subclasses (e.g.: ST_polygon)

Geometry Metadata

The different geometry storage schemas have associated metadata for discovering the existence and properties of a geometry column. In the standardized specification, there is overlap between the different metadata schema. ArcSDE has implemented the metadata schema to allow any storage schema.

An ArcSDE geometry column is called a LAYER. Layers have a number of specialized properties that are maintained by ArcSDE. These properties include:

This information is managed in three DBMS tables, called the LAYERS, SPATIAL_REF_SYS, and GEOMETRY_COLUMNS tables. Three separate tables are used so that data can be normalized (in the case of spatial references) and for ease of integration with the OpenGIS Simple Features in SQL Specification.

The LAYERS table stores a row for each spatial column in the database. Applications use the layer properties to discover available spatial data sources. The layer properties are used by ArcSDE to constrain and validate the contents of the spatial column, to index geometry values, and to properly create and manage the associated DBMS tables. The entries found in the LAYERS table vary slightly depending on the underlying DBMS.

The GEOMETRY_COLUMNS table stores a row for each column of type Geometry in the database that complies with the OpenGIS SQL specification. The ArcSDE application server treats this table as "write only"—the only time it is accessed by the ArcSDE server is when a layer is added or deleted that uses an OpenGIS SQL data format. This table is defined by the OpenGIS SQL specification, and may be updated by other applications, with geometry columns not managed by ArcSDE. When a new Geometry column is created in an OpenGIS compliant format, the fully qualified table, column name, and spatial reference ID (SRID) is added to the GEOMETRY_COLUMNS table.

Each Geometry column is associated with a Spatial Reference System. ArcSDE stores information on each Spatial Reference System in the SPATIAL_REF_SYS table. The columns of this table are those defined by the OpenGIS SQL Specification (SRID, SRTEXT, AUTH_NAME, and AUTH_SRID), and those required by ArcSDE for internal coordinate transformation. The Spatial Reference System identifies the coordinate system for a geometry and gives meaning to the numeric coordinate values for the Geometry.

Layers Table Schema (example)

The LAYERS table schema:

CREATE TABLE layers ( layer_id            INTEGER NOT NULL,
                      description         VARCHAR2(65) NULL,
                      table_name          VARCHAR2(160) NOT NULL,
                      owner               VARCHAR2(32) NOT NULL,
                      spatial_column      VARCHAR2(32) NOT NULL,
                      srid                INTEGER NOT NULL,
                      storage_type        INTEGER NOT NULL,
                      eflags              INTEGER NOT NULL,
                      gsize               FLOAT(64) NOT NULL,
                      gsize2              FLOAT(64) NOT NULL,
                      gsize3              FLOAT(64) NOT NULL,
                      minx                FLOAT(64) NOT NULL,
                      miny                FLOAT(64) NOT NULL,
                      maxx                FLOAT(64) NOT NULL,
                      maxy                FLOAT(64) NOT NULL,
                      cdate               INTEGER NOT NULL,
                      layer_config        VARCHAR2(32) NULL,
                      optimal_array_size  INTEGER NULL,
                      stats_date          INTEGER NULL,
                      minimum_id          INTEGER NULL,
                      CONSTRAINT layers_uk1 UNIQUE (layer_id),
                      CONSTRAINT layers_uk2 UNIQUE(table_name,owner));
                   -1 = SDE Compressed Binary implementation
                    0 = Normalized geometry OGIS SQL 92 implementation
                    1 = binary geometry OGIS SQL 92 implementation
                    2 = SQL Spatial Type Implementation

SPATIAL_REF_SYS Table Schema

The SPATIAL_REF_SYS schema:

CREATE TABLE spatial_ref_sys ( srid               INTEGER NOT NULL,
                               description        VARCHAR(65),
                               auth_name          VARCHAR(1024),
                               auth_srid          INTEGER,
                               falsex             FLOAT NOT NULL,
                               falsey             FLOAT NOT NULL,
                               xyunits            FLOAT NOT NULL,
                               falsez             FLOAT NOT NULL,
                               zunits             FLOAT NOT NULL,
                               falsem             FLOAT NOT NULL,
                               munits             FLOAT NOT NULL,
                               srtext             VARCHAR(2048),
                               PRIMARY KEY (srid));

Geometry_Columns Table Schema

The GEOMETRY_COLUMNS table schema:

CREATE TABLE geometry_columns ( f_table_catalog     VARCHAR(18),
                                f_table_schema      VARCHAR(18) NOT NULL,
                                f_table_name        VARCHAR(18) NOT NULL,
                                f_geometry_column   VARCHAR(18) NOT NULL,
                                srid                INTEGER NOT NULL,
                                storage_type        INTEGER NOT NULL,
                                geometry_type       INTEGER NOT NULL,
                                coord_dimension     INTEGER NOT NULL,
                                max_ppr             INTEGER NOT NULL,
                                primary key (f_table_catalog, f_table_schema,
                                             f_table_name, f_geometry_column) constraint geocol_pk,
                                foreign key (srid) references SPATIAL_REFERENCES
                                            (srid) constraint geocol_fk);

NOTE: The OpenGIS specification limits table and column names to 18 characters. ArcSDE supports 32 characters or less (based on DBMS).

       0 = Normalized geometry OGIS SQL 92 implementation
       1 = binary geometry OGIS SQL 92 implementation
       2 = OGIS SQL Spatial Type Implementation
       0 = Geometry
       1 = point
       2 = curve
       3 = linestring
       4 = surface
       5 = polygon
       6 = collection
       7 = multipoint
       8 = multicurve
       9 = multilinestring
      10 = multisurface
      11 = multipolygon

Geometry Storage

ArcSDE supports binary and SQL Geometry Type mechanisms for geometry storage. The geometry storage mechanism is identified when the layer is created. Not all storage mechanisms can be supported on all databases. The following table shows which storage schemas are available for each database:

 

Binary Geometry

Normalized Geometry

Geometry Type

IBM DB2

YES

NO

YES

Informix

YES

NO

YES

MS SQL Server

YES

NO

NO

Oracle

YES

NO

YES

Note: Oracle discontinued support for Normalized storage at the 9.2 release of their software. Consequently, ArcSDE 9.0 discontinued support for Normalized geometry schema on Oracle databases.

While the logical geometry model for all storage schemas is the same, not all ArcSDE functionality is available in all formats. For example, the OpenGIS specification does not define elevations and measures on coordinates. The following chart shows the functionality available for each storage mechanism:

 

Binary Geometry

Normalized Geometry

Geometry Type*

2D geometry

YES

YES

YES

Elevations (Z)

YES

NO

YES

Measures (M)

YES

NO

YES

Annotation

YES

NO

YES

CAD

YES

NO

YES

SQL Functions

NO

NO

YES

AREA or LENGTH as a spatial search constraint

YES

NO

YES

*The specification for the SQL Spatial Type has been extended to support ArcSDE functionality. This is possible because the actual geometry type structure is hidden behind the SQL function interfaces.

Binary Geometry Schema

The OpenGIS Specification for Simple Features in SQL defines a Binary geometry schema as one of three schemas for managing spatial data. In the Binary geometry schema, the coordinate values for the shape are stored in a binary object (called a BLOB). The BLOB is managed in a separate Geometry Table. Access to the geometry from the Business Table is through a Foreign key called the Geometry ID, or GID.

The following tables illustrate the relationship between the Business Table and the Geometry Table in the Binary geometry schema:

Business Table

Feature-ID

Column 1

Column 2

Geometry ID

101

 

 

1

102

 

 

2

103

 

 

3

&

 

 

&

 

Geometry Table

Geometry ID

Binary Geometry

1

(x,y,&,x,y)

2

(x,y,&,x,y)

3

(x,y,&,x,y)

&

&

 

Spatial Index Table

Geometry ID

Index Key

1

 

2

 

3

 

&

&

The ArcSDE binary schema is the same geometry storage schema used in earlier ArcSDE releases. This schema implements the OpenGIS Binary schema, with additional functionality, and a compressed binary representation in place of the OpenGIS Well-Known Binary Representation for Geometry. The compressed binary representation provides support for geometry properties not defined by the OpenGIS specification, including: Elevations, Measures, Annotation, and CAD data. Functions are available in the C, JAVA, and SQL type API to convert this compressed binary representation into OpenGIS Well-Known Binary and Well-Known Text representations of Geometry.

The internal format of the ArcSDE binary is defined in ArcSDE compressed binary representation .

The schema for the ArcSDE binary schema geometry table is as follows:

CREATE TABLE F<layer#> ( fid            INTEGER NOT NULL,
                         numofpts       INTEGER NOT NULL,
                         entity         SMALLINT NOT NULL,
                         eminx          FLOAT(64) NOT NULL,
                         eminy          FLOAT(64) NOT NULL,
                         emaxx          FLOAT(64) NOT NULL,
                         emaxy          FLOAT(64) NOT NULL,
                         eminz          FLOAT(64) NOT NULL,
                         emaxz          FLOAT(64) NOT NULL,
                         min_measure    FLOAT(64) NOT NULL,
                         max_measure    FLOAT(64) NOT NULL,
                         area           FLOAT(64) NOT NULL,
                         len            FLOAT(64) NOT NULL,
                         points         <BLOB DATATYPE>
                         PRIMARY KEY (fid));

SQL Spatial Type

The OpenGIS Specification for Simple Features in SQL defines a SQL Spatial type with associated SQL functions as one of three schemas for managing spatial data. In the SQL Spatial Type implementation, the coordinate values for the shape are managed as an SQL object, accessible only through SQL function invocations.

The SQL Spatial Type is just another column in the DBMS table, with well-defined properties and behavior. The actual representation of the geometry and storage of the coordinate data is DBMS specific and never exposed to the application. This hidden implementation allows the extension of the OpenGIS Specification for Simple Features in SQL with Annotation, CAD, elevations, and measures.

The following example illustrates how a geometry type looks in the table. The index is not shown, because it is now managed by the DBMS as an index on the column:

Business Table

Feature-ID

Column 1

Column 2

Column N

Geometry_Type

101

 

 

 

(x,y,&,x,y)

102

 

 

 

(x,y,&,x,y)

103

 

 

 

(x,y,&,x,y)

&

 

 

 

(x,y,&,x,y)

 

Conformance to standards

The DB2 and Informix spatial type implementations are based on the OpenGIS and SQL/MM spatial type specifications. These implementations have been conformance tested by the OpenGIS. See www.opengis.org for further conformance information.

Consult Oracle documentation and www.opengis.org for Oracle Spatial conformance information.

SQL Geometry Subtypes

The OpenGIS specification for the SQL Type implementation defines the following subtype relationships for the geometry type:

Subtype relationships between Types

ST_Curve, ST_Surface, ST_MultiCurve, and ST_MultiSurface are defined to be non-instantiable types. No constructors are defined for these types.

SQL Geometry Functions

Functions may be associated with abstract data types; for example, a geometry type could have functions to return the area or length. Functions that operate on the type are also possible. For example, functions that compute intersections or the union of two geometries, returning a new geometry as the result such as returning all parcels that intersect a specified polygon (named MyPolygon):

SELECT Parcel.Name, Parcel.Id
FROM Parcels
WHERE Intersects(Parcels.Geometry, MyPolygon)

The spatial functions are fully integrated into the SQL language allowing them to be used in SELECT statements (as above) and any other place a SQL expression would be used, such as the following INSERT statement:

INSERT INTO Countries (Name, Geometry)
 VALUES ( Kenya, PolygonFromText(POLYGON ((x y, x y, x y, ..., x y)), 14))

SQL Spatial Types and Functions are only available on extensible DBMS products. At this time, support is limited to Informix Dynamic Server, and DB2 Data Joiner. As other extensible DBMS products become available, they will be evaluated to determine if the necessary functionality exists to provide spatial type support.

The following functions are defined in the OpenGIS specification for SQL for spatial types. Functions are identified with an ST_ prefix for conformance with the SQL/MM specification, but the function signatures are the same in both specifications. Functions prefixed with SE_ are not part of the SQL/MM or OpenGIS specifications, but have been added to ArcSDE implementations on IBM DB2 and Informix to support extended functionality.

SQL functions for constructing a ST_Geometry value given its Well-known Text representation

ST_WKTToSQL(
geometryTaggedText lvarchar) : ST_Geometry

Construct an ST_Geometry value given its well-known textual representation. Note: no spatial reference sets the SRID to 0.

ST_GeomFromText(
geometryTaggedText lvarchar,
SRID Integer) : ST_Geometry

Construct an ST_Geometry value given its well-known textual representation.

ST_PointFromText (
pointTaggedText lvarchar, SRID Integer): ST_Point

Construct an ST_Point

ST_LineFromText(
lineStringTaggedText lvarchar,
SRID Integer) : ST_LineString

Construct an ST_LineString

ST_PolyFromText(
polygonTaggedText lvarchar,
SRID Integer): ST_Polygon

Construct an ST_Polygon

ST_MPointFromText (multiPointTaggedText lvarchar, SRID Integer): ST_MultiPoint

Construct an ST_MultiPoint

ST_MLineFromText (
multiLineStringTaggedText lvarchar,
SRID Integer): ST_MultiLineString

Construct an ST_MultiLineString

ST_MPolyFromText(
multiPolygonTaggedText lvarchar,
SRID Integer): ST_MultiPolygon

Construct an ST_MultiPolygon

SQL functions for constructing an ST_Geometry value given its Well-known Binary representation

ST_WKBToSQL
(WKBGeometry lvarchar) : ST_Geometry

Construct an ST_Geometry value given its well-known binary representation. Note: no spatial reference sets the SRID to 0.

ST_GeomFromWKB
(WKBGeometry lvarchar,
SRID Integer) : ST_Geometry

Construct an ST_Geometry value given its well-known binary representation.

ST_PointFromWKB (WKBPoint lvarchar, SRID Integer): ST_Point

Construct an ST_Point

ST_LineFromWKB(WKBLineString lvarchar,
SRID Integer) : ST_LineString

Construct an ST_LineString

ST_PolyFromWKB(WKBPolygon lvarchar, SRID Integer): ST_Polygon

Construct an ST_Polygon

ST_MPointFromWKB (WKBMultiPoint lvarchar,
SRID Integer): ST_MultiPoint

Construct an ST_MultiPoint

ST_MLineFromWKB (WKBMultiLineString lvarchar,
SRID Integer): ST_MultiLineString

Construct an ST_MultiLineString

ST_MPolyFromWKB (WKBMultiPolygon lvarchar,
SRID Integer): ST_MultiPolygon

Construct an ST_MultiPolygon

SQL functions for constructing an ST_Geometry value given an ESRI Shape representation

SE_ShapeToSQL(
ShapeGeometry lvarchar) : ST_Geometry

Construct an ST_Geometry value given its well-known textual representation. Note: no spatial reference sets the SRID to 0.

SE_GeomFromShape(
ShapeGeometry lvarchar,
SRID Integer) : ST_Geometry

Construct an ST_Geometry value given its well-known textual representation.

SE_PointFromShape (
ShapePoint lvarchar, srs SRID): ST_Point

Construct an ST_Point

SE_LineFromShape(
ShapeLineString lvarchar,
SRID Integer) : ST_LineString

Construct an ST_LineString

SE_PolyFromShape(
ShapePolygon lvarchar,
SRID Integer): ST_Polygon

Construct an ST_Polygon

SE_MPointFromShape (ShapemultiPoint lvarchar, SRID Integer): ST_MultiPoint

Construct an ST_MultiPoint

SE_MLineFromShape (
ShapemultiLineString lvarchar,
SRID Integer): ST_MultiLineString

Construct an ST_MultiLineString

SE_MPolyFromShape(
ShapemultiPolygon lvarchar,
SRID Integer): ST_MultiPolygon

Construct an ST_MultiPolygon

SQL functions for obtaining the Well-known Text representation of an ST_Geometry

ST_AsText (g ST_Geometry) : lvarchar

Returns the well-known textual representation of an ST_Geometry.

SQL functions for obtaining the Well-known Binary representation of an ST_Geometry

ST_AsBinary (g ST_Geometry) : lvarchar

Returns the well-known binary representation of an ST_Geometry

SQL functions for obtaining the ESRI Shape representation of an ST_Geometry

SE_AsShape (g ST_Geometry) : lvarchar

Returns the ESRI shape representation of an ST_Geometry

SQL functions on type ST_Geometry

ST_Dimension(g ST_Geometry) : Integer

Returns the geometric dimension of the ST_Geometry, which is less than or equal to the dimension of the coordinate space.

ST_CoordDim(g ST_Geometry) : Integer

Returns the coordinate dimension of the ST_Geometry value.

ST_GeometryType(g ST_Geometry) : lvarchar

Returns the name of the instantiable subtype of ST_Geometry of which this instance is a member, as a String.

ST_AsText(g ST_Geometry) : lvarchar

Returns the well-known textual representation

ST_AsBinary(g ST_Geometry) : lvarchar

Returns the well-known binary representation

SE_AsShape(g ST_Geometry) : lvarchar

Returns the well-known ESRI shape representation

ST_SRID(g ST_Geometry) : Integer

Returns the Spatial Reference System ID for this ST_Geometry.

ST_IsEmpty(g ST_Geometry) : boolean

Informix:

TRUE if this ST_Geometry corresponds to the empty set.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_IsSimple(g ST_Geometry): boolean

Informix:

TRUE if this Geometry is simple, as defined in the ST_Geometry Model.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_IsValid(g ST_Geometry): boolean

Informix:

TRUE if this ST_Geometry is valid, as defined in the ST_Geometry Model.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Boundary(g ST_Geometry) : ST_Geometry

Returns an ST_Geometry that is the combinatorial boundary of g as defined in the Geometry Model.

ST_Envelope(g ST_Geometry) : ST_Polygon

Returns the rectangle bounding g as an ST_Polygon. The polygon is defined by the corner points of the bounding box ((MINX, MINY),(MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)).

ST_Transform(g ST_Geometry, SRID Integer): ST_Geometry

Transforms the ST_Geometry into the Spatial Reference specified by the Spatial Reference System.

ST_OrderingEquals (g1 ST_Geometry, g2 ST_Geometry): boolean

Informix:

TRUE if geometries g1 and g2 are equal and coordinates are the same order.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

SE_Is3d(g ST_Geometry) : boolean

Informix:

TRUE if this ST_Geometry has Z ordinate values.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

SE_IsMeasured(g ST_Geometry) : boolean

Informix:

TRUE if this ST_Geometry has M ordinate values.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

SQL functions on type ST_Point

ST_Point (X Double Precision, Y Double Precision, SRID) : ST_Point

Returns an ST_Point, given an x-coordinate, y-coordinate, and spatial reference.

ST_X(p ST_Point) : Double Precision

Return the x-coordinate of Point p as a Double Precision number

ST_Y(p ST_Point) : Double Precision

Return the y-coordinate of Point p as a Double Precision number

SE_M(p ST_Point) : Double Precision

Return the M-coordinate of Point p as a Double Precision number

SE_Z(p ST_Point) : Double Precision

Return the Z-coordinate of Point p as a Double Precision number

SQL functions on type ST_Curve

ST_StartPoint(c ST_Curve) : ST_Point

Return a ST_Point containing the first point of an ST_Curve.

ST_EndPoint(c ST_Curve) : ST_Point

Return an ST_Point containing the last point of an ST_Curve

ST_IsClosed(c ST_Curve) : boolean

Informix:

Return TRUE if c is closed, i.e., if
StartPoint(c) = EndPoint(c)

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_IsRing(c ST_Curve) : boolean

Informix:

Return TRUE if c is a Ring, i.e., if c is closed and simple. A simple curve does not pass through the same point more than once.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Length(c ST_Curve) : Double Precision

Return the length of an ST_Curve.

SQL functions on type ST_LineString

ST_NumPoints(l ST_LineString) : Integer

Return the number of points in the ST_LineString.

ST_PointN(l ST_LineString, n Integer) : ST_Point

Return an ST_Point containing point n of the ST_LineString.

SQL functions on type ST_Surface

ST_Centroid(s ST_Surface) : ST_Point

Return the centroid of an ST_Surface, which may lie outside of the ST_Surface.

ST_PointOnSurface(s ST_Surface) : ST_Point

Return an ST_Point guaranteed to lie on the ST_Surface

ST_Area(s ST_Surface) : Double Precision

Return the area of an ST_Surface.

ST_Perimeter (s ST_Surface) : Double Precision

Return the perimeter of an ST_Surface.

SQL functions on type ST_Polygon

ST_Polygon (l ST_linestring, srid Integer) : ST_polygon

Generates an ST_Polygon from an ST_LineString.

ST_ExteriorRing(ps ST_Polygon) : ST_LineString

Return the exterior ring of p.

ST_NumInteriorRing(p ST_Polygon) : Integer

Return the number of interior rings.

ST_InteriorRingN(p ST_Polygon, n Integer) : ST_LineString

Return the nth interior ring. The order of rings is not geometrically significant.

SQL functions on type ST_GeomCollection

ST_NumGeometries(g ST_GeomCollection) : Integer

Return the number of geometries in the collection.

ST_GeometryN(g ST_GeomCollection,
n Integer) : ST_Geometry

Return the nth geometry in the collection. The order of the elements in the collection is not geometrically significant.

SQL functions on type ST_MultiCurve

ST_IsClosed(mc ST_MultiCurve) : boolean

Informix:

Return TRUE if mc is closed.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Length(mc ST_MultiCurve) : Double Precision

Return the length of mc.

SQL functions on type ST_MultiSurface

ST_Centroid(ms ST_MultiSurface) : Point

Return the centroid of ms, which may lie outside ms

ST_PointOnSurface(ms ST_MultiSurface) : Point

Return a Point guaranteed to lie on the multisurface

ST_Area(ms ST_MultiSurface) : Double Precision

Return the area of ms

ST_Perimeter (ms ST_MultiSurface) : Double Precision

Return the perimeter of the ms

SQL functions that test spatial relationships

ST_Equals(g1 ST_Geometry,g2 ST_Geometry) : boolean

Informix:

TRUE if g1 and g2 are equal.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Disjoint(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

TRUE if the intersection of g1 and g2 is the empty set.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Touches(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

TRUE if the only points in common between g1 and g2 lie in the union of the boundaries of g1 and g2.

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Within(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

TRUE if g1 is completely contained in g2.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Overlaps(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

TRUE if the intersection of g1 and g2 results in a value of the same dimension as g1 and g2 that is different from both g1 and g2.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Crosses(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

TRUE if the intersection of g1 and g2 results in a value whose dimension is less than the maximum dimension of g1 and g2, and the intersection value includes points interior to both g1 and g2, and the intersection value is not equal to either g1 or g2.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Intersects(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

Convenience predicate: TRUE if the intersection of g1 and g2 is not empty.

Intersects(g1, g2 ) Û Not (Disjoint(g1, g2 ))

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Contains(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

Convenience predicate: TRUE if g2 is completely contained in g1.

Contains(g1, g2 ) Û Within(g2 , g1)

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

SE_EnvelopesIntersect(g1 ST_Geometry, g2 ST_Geometry) : boolean

Informix:

Convenience predicate: TRUE if the intersection of the envelopes of g1 and g2 is not empty.

Intersects(g1, g2 ) Û Not (Disjoint(g1, g2 ))

 DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments.

ST_Relate(g1 ST_Geometry, g2 ST_Geometry,
patternMatrix String) : boolean

Informix:

Returns TRUE if the spatial relationship specified by the patternMatrix holds.

DB2:

The return type is Integer, with a return value of 1 for TRUE, 0 for FALSE, and 1 for UNKNOWN corresponding to a function invocation on NULL arguments..

SQL functions for distance relationships

ST_Distance(g1 ST_Geometry,
g2 ST_Geometry) : Double Precision

Return the distance between g1 and g2.

SQL functions that implement spatial operators

ST_Intersection (g1 ST_Geometry,
g2 ST_Geometry) : ST_Geometry

Return an ST_Geometry that is the set intersection of geometries g1 and g2.

ST_Difference (g1 ST_Geometry,
g2 ST_Geometry) : ST_Geometry

Return an ST_Geometry that is the closure of the set difference of g1 and g2.

ST_Union (g1 ST_Geometry,
g2 ST_Geometry) : ST_Geometry

Return an ST_Geometry that is the set union of g1 and g2.

ST_SymDifference(g1 ST_Geometry,
g2 ST_Geometry) : ST_Geometry

Return an ST_Geometry that is the closure of the set symmetric difference of g1 and g2 (logical XOR of space).

ST_Buffer (g ST_Geometry,
adistance Double Precision) : ST_Geometry

Return as ST_Geometry defined by buffering a distance d around g, where d is in the distance units for the Spatial Reference of g.

ST_ConvexHull(g ST_Geometry) : ST_Geometry

Return an ST_Geometry that is the convex hull of g.

SE_LocateAlong (g ST_Geometry,
adistance Double Precision) : ST_Geometry

Return an ST_Geometry that represents the geometry at the distance along the geometry.

SE_LocateBetween (g ST_Geometry,
adistance Double Precision,
anotherdistance Double Precision):ST_Geometry

Return an ST_Geometry that represents the geometry between the specified distances along the geometry.