st_convexhull function
Applies to:  Databricks SQL 
 Databricks Runtime 17.1 and above
Preview
This feature is in Public Preview.
nota
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the convex hull of the input GEOMETRY value as a GEOMETRY value.
Syntax
st_convexhull ( geoExpr )
Arguments
geoExpr: AGEOMETRYvalue.
Returns
Returns the convex hull of the input GEOMETRY value as a GEOMETRY value.
More precisely:
- If the input 
GEOMETRYvalue is empty, then the inputGEOMETRYvalue is returned as is. - If the input 
GEOMETRYvalue degenerates to a point, then that point is returned. - If the convex hull of the input 
GEOMETRYvalue degenerates to a linestring segment, which happens if all vertices in the input are collinear, that segment is returned. - In all other cases a polygon is returned.
 - If the input 
GEOMETRYvalue is not empty and has M coordinates, the M coordinates are dropped. 
Examples
SQL
> SELECT st_astext(st_convexhull(st_geomfromtext('POLYGON((0 0,20 0,20 10,15 5,5 10,0 25,0 0))')));
  POLYGON((0 0,0 25,20 10,20 0,0 0))