ArcGIS Server Banner

The ST_Geometry storage type

The ST_Geometry storage type

Release 9.3 E-mail This TopicPrintable VersionGive Us feedback
Note:This topic was updated for 9.3.1.

ArcSDE geodatabase storage for Oracle, DB2, Informix, and PostgreSQL uses a SQL data type built by ESRI—ST_Geometry—which provides full geodatabase support as well as SQL access to feature class geometry. This enables you to write SQL applications using your database management system (DBMS), which can access and use feature operations and queries. Each DBMS is supported as follows:


DBMS Description
Oracle The ST_Geometry data type is a high-performance storage type provided as part of ArcSDE for Oracle that includes ISO- and OGC-compliant SQL access to geodatabase features. Beginning with the ArcGIS 9.3 release, it is the default feature geometry storage format in new installations of ArcSDE geodatabases for Oracle.
IBM DB2 The DB2 Spatial Extender, provided by IBM as part of the DB2 product, is the only option used to store feature geometry in geodatabases in DB2. It was codeveloped by ESRI and IBM, is a high-performance storage type that provides ISO- and OGC-compliant SQL access to geodatabase features, and uses the ST_Geometry data type.
IBM Informix The Informix Spatial DataBlade, provided by IBM as part of the Informix product, is the only option used to store feature geometry in geodatabases in Informix. It was codeveloped by ESRI and IBM, is a high-performance storage type that provides ISO- and OGC-compliant SQL access to geodatabase features, and uses the ST_Geometry data type.
PostgreSQL The ST_Geometry data type is the default for storing feature geometry in an ArcSDE geodatabase for PostgreSQL. As with the other DBMS implementations, the PostgreSQL implementation provides ISO- and OGC-compliant SQL access to geodatabase features.

This topic describes how geometry has been implemented within ST_Geometry—as a User-defined Data Type (UDT). UDTs are data structures and functions that are defined based on the operations that can be performed on the data, not in terms of how you implement them. The IBM DB2 Spatial Extender and IBM Informix Spatial DataBlade use the ST_Geometry data type, and the ST_Geometry data type is supported in ArcSDE geodatabases for Oracle and PostgreSQL.

As a data type, ST_Geometry allows you to define columns that store spatial data. The ST_Geometry data type itself is an abstract, noninstantiated superclass, the subclasses (or subtypes) of which may be instantiated. An instantiated data type is one that can be defined as a table column and have values of its type inserted into it. A column can be defined as type ST_Geometry, but ST_Geometry values cannot be inserted into it since they cannot be instantiated. Therefore, only the subtype values can be inserted into this column. The ST_Geometry data type can accept and store any of its subtypes, while its subtypes (subclass data types) can only accept their own values.

The following chart demonstrates the hierarchy of the ST_Geometry data type and its subclasses (or subtypes). ST_Curve, ST_Surface, ST_MultiCurve, and ST_MultiSurface are defined to be noninstantiated types. No constructors are defined for these types.

ST_Geometry

Subclasses

The ST_Geometry data type is not instantiable but instead must store its instantiable subclasses. The subclasses are divided into two categories: the base geometry subclasses and the homogeneous collection subclasses. The base geometries include ST_Point, ST_LineString, and ST_Polygon, while the homogeneous collections include ST_MultiPoint, ST_MultiLineString, and ST_MultiPolygon. As the names imply, the homogeneous collections are collections of base geometries. In addition to sharing base geometry properties, homogeneous collections have some of their own properties.

To discover the subtype of an ST_Geometry, use the ST_GeometryType function. The ST_GeometryType function takes an ST_Geometry and returns the instantiated subtype in the form of a character string. To find out how many base geometry elements are contained in a homogeneous collection, use the ST_NumGeometries function, which takes a homogeneous collection and returns the number of base geometry elements it contains. The ST_GeometryN function takes a homogeneous collection and an index and returns the nth base geometry.

Each subtype stores the type of geometry implied by its name; for instance, ST_MultiPoint stores multipoints. Each subtype has particular functions that can return information about the subtype. A summary of the subtypes, their descriptions, and example functions that can be used to get information about the subtypes are listed in the table below.


Subtype Description Functions used with the subtype
ST_Point
  • A zero-dimensional geometry that occupies a single location in coordinate space.
  • Has a single x,y coordinate value, is always simple, and has a NULL boundary.
  • Used to define features such as oil wells, landmarks, and elevations.
  • ST_X—Returns a point's x-coordinate value as a double-precision number
  • ST_Y—Returns a point's y-coordinate value as a double-precision number
  • ST_Z—Returns a point's z-coordinate value as a double-precision number
  • ST_M—Returns a point's m-coordinate value as a double-precision number

ST_LineString
  • A one-dimensional object stored as a sequence of points defining a linear interpolated path.
  • ST_LineStrings have length.
  • The ST_LineString is simple if it does not intersect its interior.
  • The endpoints (the boundary) of a closed ST_LineString occupy the same point in space.
  • An ST_LineString is a ring if it is both closed and simple.
  • The endpoints normally form the boundary of an ST_LineString unless the ST_LineString is closed, in which case the boundary is NULL.
  • The interior of an ST_LineString is the connected path that lies between the endpoints, unless it is closed, in which case the interior is continuous.
  • ST_LineStrings are often used to define linear features such as roads, rivers, and power lines.

  • ST_StartPoint—Returns the first point of a linestring
  • ST_EndPoint—Returns the last point of a linestring
  • ST_PointN—Takes a linestring and an index to an nth point and returns that point
  • ST_Length—Returns a linestring's length as a double-precision number
  • ST_NumPoints—Returns the number of points in a linestring's sequence as an integer
  • ST_IsRing—Returns 1 (TRUE) if a linestring is a ring or 0 (FALSE) if it is not
  • ST_IsClosed—Returns 1 (TRUE) if a linestring is closed or 0 (FALSE) if it is not
ST_Polygon
  • A two-dimensional surface stored as a sequence of points defining its exterior bounding ring and zero or more interior rings.
  • ST_Polygon has area and is always simple.
  • The exterior and any interior rings define the boundary of an ST_Polygon, and the space enclosed between the rings defines the ST_Polygon's interior.
  • The rings of an ST_Polygon can intersect at a tangent point but never cross.
  • Defines parcels of land, water bodies, and other features having spatial extent.
  • ST_Area—Returns a polygon's area as a double-precision number
  • ST_ExteriorRing—Returns a polygon's exterior ring as a linestring
  • ST_NumInteriorRing—Returns the number of interior rings a polygon contains
  • ST_InteriorRingN—Takes a polygon and an index and returns the nth interior ring as a linestring
  • ST_Centroid—Returns a point that is the center of the polygon's envelope
  • ST_PointOnSurface—Returns a point that is guaranteed to be on the surface of the polygon

ST_MultiPoint
  • A collection of ST_Points.
  • Has a dimension of 0.
  • An ST_MultiPoint is simple if none of its elements occupy the same coordinate space.
  • The boundary of an ST_MultiPoint is NULL.
  • Defines such things as aerial broadcast patterns and incidents of a disease outbreak.

ST_MultiLineString
  • A collection of ST_LineStrings.
  • ST_MultiLineStrings have length.
  • ST_MultiLineStrings are simple if they only intersect at the endpoints of the ST_LineString elements.
  • ST_MultiLineStrings are nonsimple if the interiors of the ST_LineString elements intersect.
  • The boundary of an ST_MultiLineString is the nonintersected endpoints of the ST_LineString elements.
  • The ST_MultiLineString is closed if all its ST_LineString elements are closed.
  • The boundary of an ST_MultiLineString is NULL if all the endpoints of all the elements are intersected.
  • Used to define entities such as streams or road networks.

  • ST_Length—Returns the cumulative length of all the ST_LineString elements of a multilinestring as a double-precision number
  • ST_IsClosed—Returns 1 (TRUE) if the multilinestring is closed and 0 (FALSE) if it is not
ST_MultiPolygon
  • A collection of polygons.
  • ST_MultiPolygons have area.
  • The boundary of an ST_MultiPolygon is the cumulative length of its elements' exterior and interior rings.
  • The interior of an ST_MultiPolygon is defined as the cumulative interiors of its element ST_Polygons.
  • The boundary of an ST_MultiPolygon's elements can only intersect at a tangent point.
  • Defines features such as a forest stratum or a noncontiguous parcel of land such as a Pacific island chain.
  • ST_Area—Returns the cumulative ST_Area of a multipolygon's polygon elements as a double-precision number
  • ST_Centroid—Returns a point that is the center of a multipolygon's envelope
  • ST_PointOnSurface—Returns a point that is guaranteed to be normal to the surface of one of the multipolygon's polygon elements

Note that each subtype inherits the properties of the ST_Geometry superclass but also has properties of its own. Functions that operate on the ST_Geometry data type accept any of the subclass data types (subtypes). However, some functions have been defined at the subtype level and only accept certain subtypes. For example, the ST_GeometryN function only takes ST_MultiLinestring, ST_MultiPoint, or ST_MultiPolygon subtype values as input.

Using ST_Geometry with ArcGIS

ArcGIS is designed to work with the ST_Geometry spatial type through ArcSDE. ST_Geometry is the spatial storage type when using ArcSDE for DB2 or ArcSDE for Informix. ArcSDE for PostgreSQL uses the ST_Geometry spatial type by default but also supports the PostGIS spatial type for geometry storage. ArcSDE for Oracle also uses ST_Geometry by default and additionally supports a number of different geometry storage types such as SDELOB, SDO_Geometry, and SDEBINARY. These different schemas can all be used together in the same database. While there can only be one default geometry schema, individual feature classes can be created using different geometry schemas.

ESRI recommends creating feature classes in spatial type format using ArcGIS versus using SQL. This recommendation is based on the following:

If you do not create feature classes in spatial type format using ArcGIS, you must do the following:

The last two steps are explained in the last section of the topic Enhancing ArcGIS functionality using spatial types.

Creating a new feature class with ArcGIS

There are four primary ways to create a new feature class in your geodatabase:

For instructions on how to create a new feature class using ArcGIS, see Creating feature classes.

When you create new feature classes in a geodatabase in DB2 or Informix, it automatically uses ST_Geometry storage. If you keep the default DBTUNE settings in a geodatabase in Oracle or PostgreSQL, newly created feature classes will also use ST_Geometry storage.

At this stage, you now have a feature class stored in ST_Geometry format. In addition to being ready for use by ArcGIS, the feature class is also available for use via spatial-type SQL operators and functions.

See Also

  • An overview of feature geometry and raster data storage
  • ST_Geometry storage in Oracle
  • ST_Geometry storage in PostgreSQL
  • The DB2 Spatial Extender geometry type
  • The Informix Spatial DataBlade geometry type