Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - Spatial Data Support » Spatial data » Support for spatial data

Supported spatial data types and their hierarchy

Spatial support follows the SQL Multimedia (SQL/MM) standard for storing and accessing geospatial data.

A key component of this standard is the use of the ST_Geometry type hierarchy to define how geospatial data is created. Within the hierarchy, the prefix ST is used for all data types (also referred to as classes or types). When a column is identified as a specific type, the values of the type and its subtypes can be stored in the column. For example, a column identified as ST_Geometry can also store the ST_LineString and ST_MultiLineString values.

Descriptions of supported spatial data types

The following spatial data types are supported:

  • Geometries

    The term geometry means the overarching type for objects such as points, linestrings, and polygons. The geometry type is the supertype for all supported spatial data types.

  • Points

    A point defines a single location in space. A point geometry does not have length or area. A point always has an X and Y coordinate.

    ST_Dimension returns 0 for non-empty points.

    In GIS data, points are typically used to represent locations such as addresses, or geographic features such as a mountain.

  • Multipoints

    A multipoint is a collection of individual points.

    In GIS data, multipoints are typically used to represent a set of locations.

  • Linestrings

    A linestring is geometry with a length, but without any area. ST_Dimension returns 1 for non-empty linestrings. Linestrings can be characterized by whether they are simple or not simple, closed or not closed. Simple means a linestring that does not cross itself. Closed means a linestring that starts and ends at the same point. For example, a ring is an example of simple, closed linestring.

    In GIS data, linestrings are typically used to represent rivers, roads, or delivery routes.

  • Multilinestring

    A multilinestring is a collection of linestrings.

    In GIS data, multilinestrings are often used to represent geographic features like rivers or a highway network.

  • Polygons

    A polygon defines a region of space. A polygon is constructed from one exterior bounding ring that defines the outside of the region and zero or more interior rings which define holes in the region. A polygon has an associated area but no length.

    ST_Dimension returns 2 for non-empty polygons.

    In GIS data, polygons are typically used to represent territories (counties, towns, states, and so on), lakes, and large geographic features such as parks.

  • Multipolygons

    A multipolygon is a collection of zero or more polygons.

    In GIS data, multipolygons are often used to represent territories made up of multiple regions (for example a state with islands), or geographic features such as a system of lakes.

  • Circularstrings

    A circularstring is a connected sequence of circular arc segments; much like a linestring with circular arcs between points.

  • Compound curves

    A compound curve is a connected sequence of circularstrings or linestrings.

  • Curve polygons

    A curve polygon is a more general polygon that may have circular arc boundary segments.

  • Geometry collections

    A geometry collection is a collection of one or more geometries (such as points, lines, polygons, and so on).

  • Multisurfaces

    A multisurface is a collection of curve polygons.

Spatial type hierarchy

The following diagram illustrates the hierarchy of the ST_Geometry data types and their subtypes:

Diagram of all supported spatial types in hierarchical form

The types on the left are supertypes (or base types) for the subtypes (or derived types) on the right.

Object-oriented properties of spatial data types
  • A subtype (or derived type) is more specific than its supertype (or base type). For example, ST_LineString is a more specific type of ST_Curve.

  • A subtype inherits all methods from all supertypes. For example, ST_Polygon values can call methods from the ST_Geometry, ST_Surface and ST_CurvePolygon supertypes.

  • A value of a subtype can be automatically converted to any of its supertypes. For example, an ST_Point value can be used where a ST_Geometry parameter is required, as in point1.ST_Distance( point2 ).

  • A column or variable can store a values of any subtype. For example, a column of type ST_Geometry can store spatial values of any type.

  • A column, variable, or expression with a declared type can be treated as, or cast to a subtype. For example, you can use the TREAT expression to change a ST_Polygon value in a ST_Geometry column named geom to have declared type ST_Surface so you can call the ST_Area method on it with TREAT( geom AS ST_Polygon ).ST_Area().