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
as a GEOMETRY
.
Syntax
st_convexhull ( geoExpr )
Arguments
geoExpr
: AGEOMETRY
value.
Returns
Returns the convex hull of the input GEOMETRY
(represented as a GEOMETRY
value or using a standard
geospatial format) as a GEOMETRY
.
More precisely:
- If the input
GEOMETRY
is empty, then theGEOMETRY
is returned as is. - If the input
GEOMETRY
degenerates to a point, then that point is returned. - If the convex hull of the input
GEOMETRY
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
GEOMETRY
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))