Geometry

<< Click to Display Table of Contents >>

Navigation:  Connectors > MySQL >

Geometry

 

MySQL uses the ST Geometry format with following distinct types:

geometry

point

linestring

polygon

multipoint

multilinestring

multipolygon

geometrycollection

 

All types are functionally equivalent, the only distinction is what ST subtype each allows. While geometry allows any ST subtype to be stored, the others only allow the homonym subtype (i.e. only LINESTRING geometries are allowed in a linestring column or variable).

 

Geometry Types

 

Here is how MySQL (ST) geometry subtypes map to GeoJson geometry types.

 

ST Subtype / MySQL Type

Interpretation

GeoJson Geometry Type

POINT / point or geometry

Single point

Point

MULTIPOINT / multipoint or geometry

Multiple points

MultiPoint

LINESTRING / linestring or geometry

Sequence of straight lines without gaps

LineString

CIRCULARSTRING / geometry

Sequence of circle arcs without gaps

LineString + DTS corrections

MULTILINESTRING / multilinestring or geometry

Multiple LINESTRINGs (not necessarily connected)

MultiLineString

COMPOUNDCURVE / geometry

Sequence of connected LINESTRINGs and CIRCULARLINESTRINGs

MultiLineString + DTS corrections

POLYGON / polygon or geometry

Polygon (with or without holes)

Polygon

CURVEPOLYGON / geometry

Polygon whose boundaries can contain circle arcs

Polygon + DTS corrections

MULTIPOLYGON / mulipolygon or geometry

Multiple POLYGONs

MultiPolygon (+ DTS corrections)

GEOMETRYCOLLECTION / geometrycollection or geometry

Collection of any of the above

GeometryCollection (+ DTS corrections)

 

Z and M modifiers (e.g. POINT Z) are supported for all geometry types (except GEOMETRYCOLLECTION where they are not applicable), but the M values are always ignored and processing geometries with Z values has certain limitations.

 

Information-icon_16px Further reading:

MySQL Spatial Reference

DTS Geometry Overview