The set of geometry types proposed by OGC's SQL with Geometry Types environment is based on the OpenGIS Geometry Model. In this model, each geometric object has the following general properties:
-
It is associated with a Spatial Reference System, which describes the coordinate space in which the object is defined.
-
It belongs to some geometry class.
The geometry classes define a hierarchy as follows:
-
Geometry(non-instantiable)-
Point(instantiable) -
Curve(non-instantiable)-
LineString(instantiable)-
Line -
LinearRing
-
-
-
Surface(non-instantiable)-
Polygon(instantiable)
-
-
GeometryCollection(instantiable)-
MultiPoint(instantiable) -
MultiCurve(non-instantiable)-
MultiLineString(instantiable)
-
-
MultiSurface(non-instantiable)-
MultiPolygon(instantiable)
-
-
-
It is not possible to create objects in non-instantiable classes. It is possible to create objects in instantiable classes. All classes have properties, and instantiable classes may also have assertions (rules that define valid class instances).
Geometry is the base class. It is an abstract
class. The instantiable subclasses of
Geometry are restricted to zero-, one-, and
two-dimensional geometric objects that exist in two-dimensional
coordinate space. All instantiable geometry classes are defined
so that valid instances of a geometry class are topologically
closed (that is, all defined geometries include their boundary).
The base Geometry class has subclasses for
Point, Curve,
Surface, and
GeometryCollection:
-
Pointrepresents zero-dimensional objects. -
Curverepresents one-dimensional objects, and has subclassLineString, with sub-subclassesLineandLinearRing. -
Surfaceis designed for two-dimensional objects and has subclassPolygon. -
GeometryCollectionhas specialized zero-, one-, and two-dimensional collection classes namedMultiPoint,MultiLineString, andMultiPolygonfor modeling geometries corresponding to collections ofPoints,LineStrings, andPolygons, respectively.MultiCurveandMultiSurfaceare introduced as abstract superclasses that generalize the collection interfaces to handleCurvesandSurfaces.
Geometry, Curve,
Surface, MultiCurve, and
MultiSurface are defined as non-instantiable
classes. They define a common set of methods for their
subclasses and are included for extensibility.
Point, LineString,
Polygon,
GeometryCollection,
MultiPoint,
MultiLineString, and
MultiPolygon are instantiable classes.
Geometry is the root class of the hierarchy.
It is a non-instantiable class but has a number of properties
that are common to all geometry values created from any of the
Geometry subclasses. These properties are
described in the following list. Particular subclasses have
their own specific properties, described later.
Geometry Properties
A geometry value has the following properties:
-
Its type. Each geometry belongs to one of the instantiable classes in the hierarchy.
-
Its SRID, or Spatial Reference Identifier. This value identifies the geometry's associated Spatial Reference System that describes the coordinate space in which the geometry object is defined.
In MySQL, the SRID value is just an integer associated with the geometry value. All calculations are done assuming Euclidean (planar) geometry.
-
Its coordinates in its Spatial Reference System, represented as double-precision (eight-byte) numbers. All non-empty geometries include at least one pair of (X,Y) coordinates. Empty geometries contain no coordinates.
Coordinates are related to the SRID. For example, in different coordinate systems, the distance between two objects may differ even when objects have the same coordinates, because the distance on the planar coordinate system and the distance on the geocentric system (coordinates on the Earth's surface) are different things.
-
Its interior, boundary, and exterior.
Every geometry occupies some position in space. The exterior of a geometry is all space not occupied by the geometry. The interior is the space occupied by the geometry. The boundary is the interface between the geometry's interior and exterior.
-
Its MBR (Minimum Bounding Rectangle), or Envelope. This is the bounding geometry, formed by the minimum and maximum (X,Y) coordinates:
((MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY))
-
Whether the value is simple or non-simple. Geometry values of types (
LineString,MultiPoint,MultiLineString) are either simple or non-simple. Each type determines its own assertions for being simple or non-simple. -
Whether the value is closed or not closed. Geometry values of types (
LineString,MultiString) are either closed or not closed. Each type determines its own assertions for being closed or not closed. -
Whether the value is empty or non-empty A geometry is empty if it does not have any points. Exterior, interior, and boundary of an empty geometry are not defined (that is, they are represented by a
NULLvalue). An empty geometry is defined to be always simple and has an area of 0. -
Its dimension. A geometry can have a dimension of –1, 0, 1, or 2:
-
–1 for an empty geometry.
-
0 for a geometry with no length and no area.
-
1 for a geometry with non-zero length and zero area.
-
2 for a geometry with non-zero area.
Pointobjects have a dimension of zero.LineStringobjects have a dimension of 1.Polygonobjects have a dimension of 2. The dimensions ofMultiPoint,MultiLineString, andMultiPolygonobjects are the same as the dimensions of the elements they consist of. -
A Point is a geometry that represents a
single location in coordinate space.
Point
Examples
-
Imagine a large-scale map of the world with many cities. A
Pointobject could represent each city. -
On a city map, a
Pointobject could represent a bus stop.
Point
Properties
-
X-coordinate value.
-
Y-coordinate value.
-
Pointis defined as a zero-dimensional geometry. -
The boundary of a
Pointis the empty set.
A Curve is a one-dimensional geometry,
usually represented by a sequence of points. Particular
subclasses of Curve define the type of
interpolation between points. Curve is a
non-instantiable class.
Curve
Properties
-
A
Curvehas the coordinates of its points. -
A
Curveis defined as a one-dimensional geometry. -
A
Curveis simple if it does not pass through the same point twice. -
A
Curveis closed if its start point is equal to its endpoint. -
The boundary of a closed
Curveis empty. -
The boundary of a non-closed
Curveconsists of its two endpoints. -
A
Curvethat is simple and closed is aLinearRing.
A LineString is a Curve
with linear interpolation between points.
LineString
Examples
-
On a world map,
LineStringobjects could represent rivers. -
In a city map,
LineStringobjects could represent streets.
LineString
Properties
-
A
LineStringhas coordinates of segments, defined by each consecutive pair of points. -
A
LineStringis aLineif it consists of exactly two points. -
A
LineStringis aLinearRingif it is both closed and simple.
A Surface is a two-dimensional geometry. It
is a non-instantiable class. Its only instantiable subclass is
Polygon.
Surface
Properties
-
A
Surfaceis defined as a two-dimensional geometry. -
The OpenGIS specification defines a simple
Surfaceas a geometry that consists of a single “patch” that is associated with a single exterior boundary and zero or more interior boundaries. -
The boundary of a simple
Surfaceis the set of closed curves corresponding to its exterior and interior boundaries.
A Polygon is a planar
Surface representing a multisided geometry.
It is defined by a single exterior boundary and zero or more
interior boundaries, where each interior boundary defines a hole
in the Polygon.
Polygon
Examples
-
On a region map,
Polygonobjects could represent forests, districts, and so on.
Polygon
Assertions
-
The boundary of a
Polygonconsists of a set ofLinearRingobjects (that is,LineStringobjects that are both simple and closed) that make up its exterior and interior boundaries. -
A
Polygonhas no rings that cross. The rings in the boundary of aPolygonmay intersect at aPoint, but only as a tangent. -
A
Polygonhas no lines, spikes, or punctures. -
A
Polygonhas an interior that is a connected point set. -
A
Polygonmay have holes. The exterior of aPolygonwith holes is not connected. Each hole defines a connected component of the exterior.
The preceding assertions make a Polygon a
simple geometry.
A GeometryCollection is a geometry that is a
collection of one or more geometries of any class.
All the elements in a GeometryCollection must
be in the same Spatial Reference System (that is, in the same
coordinate system). There are no other constraints on the
elements of a GeometryCollection, although
the subclasses of GeometryCollection
described in the following sections may restrict membership.
Restrictions may be based on:
-
Element type (for example, a
MultiPointmay contain onlyPointelements) -
Dimension
-
Constraints on the degree of spatial overlap between elements
A MultiPoint is a geometry collection
composed of Point elements. The points are
not connected or ordered in any way.
MultiPoint
Examples
-
On a world map, a
MultiPointcould represent a chain of small islands. -
On a city map, a
MultiPointcould represent the outlets for a ticket office.
MultiPoint
Properties
-
A
MultiPointis a zero-dimensional geometry. -
A
MultiPointis simple if no two of itsPointvalues are equal (have identical coordinate values). -
The boundary of a
MultiPointis the empty set.
A MultiCurve is a geometry collection
composed of Curve elements.
MultiCurve is a non-instantiable class.
MultiCurve
Properties
-
A
MultiCurveis a one-dimensional geometry. -
A
MultiCurveis simple if and only if all of its elements are simple; the only intersections between any two elements occur at points that are on the boundaries of both elements. -
A
MultiCurveboundary is obtained by applying the “mod 2 union rule” (also known as the “odd-even rule”): A point is in the boundary of aMultiCurveif it is in the boundaries of an odd number ofMultiCurveelements. -
A
MultiCurveis closed if all of its elements are closed. -
The boundary of a closed
MultiCurveis always empty.
A MultiLineString is a
MultiCurve geometry collection composed of
LineString elements.
MultiLineString
Examples
-
On a region map, a
MultiLineStringcould represent a river system or a highway system.
A MultiSurface is a geometry collection
composed of surface elements. MultiSurface is
a non-instantiable class. Its only instantiable subclass is
MultiPolygon.
MultiSurface
Assertions
-
Two
MultiSurfacesurfaces have no interiors that intersect. -
Two
MultiSurfaceelements have boundaries that intersect at most at a finite number of points.
A MultiPolygon is a
MultiSurface object composed of
Polygon elements.
MultiPolygon
Examples
-
On a region map, a
MultiPolygoncould represent a system of lakes.
MultiPolygon
Assertions
-
A
MultiPolygonhas no twoPolygonelements with interiors that intersect. -
A
MultiPolygonhas no twoPolygonelements that cross (crossing is also forbidden by the previous assertion), or that touch at an infinite number of points. -
A
MultiPolygonmay not have cut lines, spikes, or punctures. AMultiPolygonis a regular, closed point set. -
A
MultiPolygonthat has more than onePolygonhas an interior that is not connected. The number of connected components of the interior of aMultiPolygonis equal to the number ofPolygonvalues in theMultiPolygon.
MultiPolygon
Properties
-
A
MultiPolygonis a two-dimensional geometry. -
A
MultiPolygonboundary is a set of closed curves (LineStringvalues) corresponding to the boundaries of itsPolygonelements. -
Each
Curvein the boundary of theMultiPolygonis in the boundary of exactly onePolygonelement. -
Every
Curvein the boundary of anPolygonelement is in the boundary of theMultiPolygon.