top of page
CerebroSQL

MySQL: 

ST_CONVEXHULL

ST_ConvexHull(g)

Returns a geometry that represents the convex hull of the geometry
value g.

This function computes a geometry's convex hull by first checking
whether its vertex points are colinear. The function returns a linear
hull if so, a polygon hull otherwise. This function processes geometry
collections by extracting all vertex points of all components of the
collection, creating a MultiPoint value from them, and computing its
convex hull.

ST_ConvexHull() handles its arguments as described in the introduction
to this section, with this exception:

o The return value is NULL for the additional condition that the
argument is an empty geometry collection.

URL: https://dev.mysql.com/doc/refman/8.0/en/spatial-operator-functions.html

Example

mysql> SET @g = 'MULTIPOINT(5 0,25 0,15 10,15 25)';
mysql> SELECT ST_AsText(ST_ConvexHull(ST_GeomFromText(@g)));
+-----------------------------------------------+
| ST_AsText(ST_ConvexHull(ST_GeomFromText(@g))) |
+-----------------------------------------------+
| POLYGON((5 0,25 0,15 25,5 0)) |
+-----------------------------------------------+

bottom of page