メインコンテンツまでスキップ

st_convexhull function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 17.1 and above

Preview

This feature is in Public Preview.

注記

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: A GEOMETRY value.

Returns

Returns the convex hull of the input GEOMETRY value as a GEOMETRY value. More precisely:

  • If the input GEOMETRY value is empty, then the input GEOMETRY value is returned as is.
  • If the input GEOMETRY value degenerates to a point, then that point is returned.
  • If the convex hull of the input GEOMETRY value 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 value 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))