Skip navigation links
**Section Navigation** [Toggle]

- Documentation Library
**Table of Contents**- MySQL 5.7 Manual
- MySQL 5.6 Manual
- MySQL 5.5 Manual
- MySQL 5.1 Manual
- MySQL 5.0 Manual
- MySQL 3.23/4.0/4.1 Manual

MySQL 3.23, 4.0, 4.1 Reference Manual :: 16 Spatial Extensions :: 16.2 The OpenGIS Geometry Model :: 16.2.2 Class Geometry

- 16.2 The OpenGIS Geometry Model
- 16.2.1 The Geometry Class Hierarchy
- 16.2.2 Class Geometry
- 16.2.3 Class Point
- 16.2.4 Class Curve
- 16.2.5 Class LineString
- 16.2.6 Class Surface
- 16.2.7 Class Polygon
- 16.2.8 Class GeometryCollection
- 16.2.9 Class MultiPoint
- 16.2.10 Class MultiCurve
- 16.2.11 Class MultiLineString
- 16.2.12 Class MultiSurface
- 16.2.13 Class MultiPolygon

`Geometry`

is the root class of the hierarchy.
It is a noninstantiable 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 nonempty 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**nonsimple**. Geometry values of types (`LineString`

,`MultiPoint`

,`MultiLineString`

) are either simple or nonsimple. Each type determines its own assertions for being simple or nonsimple.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**nonempty**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`NULL`

value). 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 nonzero length and zero area.

2 for a geometry with nonzero area.

`Point`

objects have a dimension of zero.`LineString`

objects have a dimension of 1.`Polygon`

objects have a dimension of 2. The dimensions of`MultiPoint`

,`MultiLineString`

, and`MultiPolygon`

objects are the same as the dimensions of the elements they consist of.

Copyright © 1997, 2014, Oracle and/or its affiliates. All
rights reserved.
Legal Notices

## User Comments

If you are looking for a SQL function to count distance between 2 points, try this article — http://i1t2b3.com/2010/11/04/sql-function-to-count-distance-between-two-points/

Example of usage:

> SELECT DISTANCE(city1.lat, city1.lng, city2.lat, city2.lng);