Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
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
> 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))