MySQL 5.7 Reference Manual Including MySQL NDB Cluster 7.5 and NDB Cluster 7.6

The following table lists each spatial function and provides a short description of each one.

**Table 12.21 Spatial Functions**

Name | Description | Deprecated |
---|---|---|

`Area()` |
Return Polygon or MultiPolygon area | Yes |

`AsBinary()` , `AsWKB()` |
Convert from internal geometry format to WKB | Yes |

`AsText()` , `AsWKT()` |
Convert from internal geometry format to WKT | Yes |

`Buffer()` |
Return geometry of points within given distance from geometry | Yes |

`Centroid()` |
Return centroid as a point | Yes |

`Contains()` |
Whether MBR of one geometry contains MBR of another | Yes |

`ConvexHull()` |
Return convex hull of geometry | Yes |

`Crosses()` |
Whether one geometry crosses another | Yes |

`Dimension()` |
Dimension of geometry | Yes |

`Disjoint()` |
Whether MBRs of two geometries are disjoint | Yes |

`Distance()` |
The distance of one geometry from another | Yes |

`EndPoint()` |
End Point of LineString | Yes |

`Envelope()` |
Return MBR of geometry | Yes |

`Equals()` |
Whether MBRs of two geometries are equal | Yes |

`ExteriorRing()` |
Return exterior ring of Polygon | Yes |

`GeomCollFromText()` , `GeometryCollectionFromText()` |
Return geometry collection from WKT | Yes |

`GeomCollFromWKB()` , `GeometryCollectionFromWKB()` |
Return geometry collection from WKB | Yes |

`GeometryCollection()` |
Construct geometry collection from geometries | |

`GeometryN()` |
Return N-th geometry from geometry collection | Yes |

`GeometryType()` |
Return name of geometry type | Yes |

`GeomFromText()` , `GeometryFromText()` |
Return geometry from WKT | Yes |

`GeomFromWKB()` , `GeometryFromWKB()` |
Return geometry from WKB | Yes |

`GLength()` |
Return length of LineString | Yes |

`InteriorRingN()` |
Return N-th interior ring of Polygon | Yes |

`Intersects()` |
Whether MBRs of two geometries intersect | Yes |

`IsClosed()` |
Whether a geometry is closed and simple | Yes |

`IsEmpty()` |
Whether a geometry is empty | Yes |

`IsSimple()` |
Whether a geometry is simple | Yes |

`LineFromText()` , `LineStringFromText()` |
Construct LineString from WKT | Yes |

`LineFromWKB()` , `LineStringFromWKB()` |
Construct LineString from WKB | Yes |

`LineString()` |
Construct LineString from Point values | |

`MBRContains()` |
Whether MBR of one geometry contains MBR of another | |

`MBRCoveredBy()` |
Whether one MBR is covered by another | |

`MBRCovers()` |
Whether one MBR covers another | |

`MBRDisjoint()` |
Whether MBRs of two geometries are disjoint | |

`MBREqual()` |
Whether MBRs of two geometries are equal | Yes |

`MBREquals()` |
Whether MBRs of two geometries are equal | |

`MBRIntersects()` |
Whether MBRs of two geometries intersect | |

`MBROverlaps()` |
Whether MBRs of two geometries overlap | |

`MBRTouches()` |
Whether MBRs of two geometries touch | |

`MBRWithin()` |
Whether MBR of one geometry is within MBR of another | |

`MLineFromText()` , `MultiLineStringFromText()` |
Construct MultiLineString from WKT | Yes |

`MLineFromWKB()` , `MultiLineStringFromWKB()` |
Construct MultiLineString from WKB | Yes |

`MPointFromText()` , `MultiPointFromText()` |
Construct MultiPoint from WKT | Yes |

`MPointFromWKB()` , `MultiPointFromWKB()` |
Construct MultiPoint from WKB | Yes |

`MPolyFromText()` , `MultiPolygonFromText()` |
Construct MultiPolygon from WKT | Yes |

`MPolyFromWKB()` , `MultiPolygonFromWKB()` |
Construct MultiPolygon from WKB | Yes |

`MultiLineString()` |
Contruct MultiLineString from LineString values | |

`MultiPoint()` |
Construct MultiPoint from Point values | |

`MultiPolygon()` |
Construct MultiPolygon from Polygon values | |

`NumGeometries()` |
Return number of geometries in geometry collection | Yes |

`NumInteriorRings()` |
Return number of interior rings in Polygon | Yes |

`NumPoints()` |
Return number of points in LineString | Yes |

`Overlaps()` |
Whether MBRs of two geometries overlap | Yes |

`Point()` |
Construct Point from coordinates | |

`PointFromText()` |
Construct Point from WKT | Yes |

`PointFromWKB()` |
Construct Point from WKB | Yes |

`PointN()` |
Return N-th point from LineString | Yes |

`PolyFromText()` , `PolygonFromText()` |
Construct Polygon from WKT | Yes |

`PolyFromWKB()` , `PolygonFromWKB()` |
Construct Polygon from WKB | Yes |

`Polygon()` |
Construct Polygon from LineString arguments | |

`SRID()` |
Return spatial reference system ID for geometry | Yes |

`ST_Area()` |
Return Polygon or MultiPolygon area | |

`ST_AsBinary()` , `ST_AsWKB()` |
Convert from internal geometry format to WKB | |

`ST_AsGeoJSON()` |
Generate GeoJSON object from geometry | |

`ST_AsText()` , `ST_AsWKT()` |
Convert from internal geometry format to WKT | |

`ST_Buffer()` |
Return geometry of points within given distance from geometry | |

`ST_Buffer_Strategy()` |
Produce strategy option for ST_Buffer() | |

`ST_Centroid()` |
Return centroid as a point | |

`ST_Contains()` |
Whether one geometry contains another | |

`ST_ConvexHull()` |
Return convex hull of geometry | |

`ST_Crosses()` |
Whether one geometry crosses another | |

`ST_Difference()` |
Return point set difference of two geometries | |

`ST_Dimension()` |
Dimension of geometry | |

`ST_Disjoint()` |
Whether one geometry is disjoint from another | |

`ST_Distance()` |
The distance of one geometry from another | |

`ST_Distance_Sphere()` |
Minimum distance on earth between two geometries | |

`ST_EndPoint()` |
End Point of LineString | |

`ST_Envelope()` |
Return MBR of geometry | |

`ST_Equals()` |
Whether one geometry is equal to another | |

`ST_ExteriorRing()` |
Return exterior ring of Polygon | |

`ST_GeoHash()` |
Produce a geohash value | |

`ST_GeomCollFromText()` , `ST_GeometryCollectionFromText()` , `ST_GeomCollFromTxt()` |
Return geometry collection from WKT | |

`ST_GeomCollFromWKB()` , `ST_GeometryCollectionFromWKB()` |
Return geometry collection from WKB | |

`ST_GeometryN()` |
Return N-th geometry from geometry collection | |

`ST_GeometryType()` |
Return name of geometry type | |

`ST_GeomFromGeoJSON()` |
Generate geometry from GeoJSON object | |

`ST_GeomFromText()` , `ST_GeometryFromText()` |
Return geometry from WKT | |

`ST_GeomFromWKB()` , `ST_GeometryFromWKB()` |
Return geometry from WKB | |

`ST_InteriorRingN()` |
Return N-th interior ring of Polygon | |

`ST_Intersection()` |
Return point set intersection of two geometries | |

`ST_Intersects()` |
Whether one geometry intersects another | |

`ST_IsClosed()` |
Whether a geometry is closed and simple | |

`ST_IsEmpty()` |
Whether a geometry is empty | |

`ST_IsSimple()` |
Whether a geometry is simple | |

`ST_IsValid()` |
Whether a geometry is valid | |

`ST_LatFromGeoHash()` |
Return latitude from geohash value | |

`ST_Length()` |
Return length of LineString | |

`ST_LineFromText()` , `ST_LineStringFromText()` |
Construct LineString from WKT | |

`ST_LineFromWKB()` , `ST_LineStringFromWKB()` |
Construct LineString from WKB | |

`ST_LongFromGeoHash()` |
Return longitude from geohash value | |

`ST_MakeEnvelope()` |
Rectangle around two points | |

`ST_MLineFromText()` , `ST_MultiLineStringFromText()` |
Construct MultiLineString from WKT | |

`ST_MLineFromWKB()` , `ST_MultiLineStringFromWKB()` |
Construct MultiLineString from WKB | |

`ST_MPointFromText()` , `ST_MultiPointFromText()` |
Construct MultiPoint from WKT | |

`ST_MPointFromWKB()` , `ST_MultiPointFromWKB()` |
Construct MultiPoint from WKB | |

`ST_MPolyFromText()` , `ST_MultiPolygonFromText()` |
Construct MultiPolygon from WKT | |

`ST_MPolyFromWKB()` , `ST_MultiPolygonFromWKB()` |
Construct MultiPolygon from WKB | |

`ST_NumGeometries()` |
Return number of geometries in geometry collection | |

`ST_NumInteriorRing()` , `ST_NumInteriorRings()` |
Return number of interior rings in Polygon | |

`ST_NumPoints()` |
Return number of points in LineString | |

`ST_Overlaps()` |
Whether one geometry overlaps another | |

`ST_PointFromGeoHash()` |
Convert geohash value to POINT value | |

`ST_PointFromText()` |
Construct Point from WKT | |

`ST_PointFromWKB()` |
Construct Point from WKB | |

`ST_PointN()` |
Return N-th point from LineString | |

`ST_PolyFromText()` , `ST_PolygonFromText()` |
Construct Polygon from WKT | |

`ST_PolyFromWKB()` , `ST_PolygonFromWKB()` |
Construct Polygon from WKB | |

`ST_Simplify()` |
Return simplified geometry | |

`ST_SRID()` |
Return spatial reference system ID for geometry | |

`ST_StartPoint()` |
Start Point of LineString | |

`ST_SymDifference()` |
Return point set symmetric difference of two geometries | |

`ST_Touches()` |
Whether one geometry touches another | |

`ST_Union()` |
Return point set union of two geometries | |

`ST_Validate()` |
Return validated geometry | |

`ST_Within()` |
Whether one geometry is within another | |

`ST_X()` |
Return X coordinate of Point | |

`ST_Y()` |
Return Y coordinate of Point | |

`StartPoint()` |
Start Point of LineString | Yes |

`Touches()` |
Whether one geometry touches another | Yes |

`Within()` |
Whether MBR of one geometry is within MBR of another | Yes |

`X()` |
Return X coordinate of Point | Yes |

`Y()` |
Return Y coordinate of Point | Yes |