Pular para o conteúdo principal

st_concavehull function

Applies to: check marked yes Databricks SQL check marked yes 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 concave hull of the input GEOMETRY value as a GEOMETRY value using the specified length ratio.

Syntax

st_concavehull ( geoExpr, lengthRatioExpr[, allowHolesExpr])

Arguments

  • geoExpr: A GEOMETRY value.
  • lengthRatio - A DOUBLE value between 0 and 1, inclusive, representing the length ratio used to compute the concave hull.
  • allowHoles - An optional BOOLEAN value, indicating whether the output geometry, if a polygon, is allowed to have holes. The default value is false.

Returns

Returns a GEOMETRY value that is the concave hull of the input GEOMETRY value using the specified length ratio. The resulting geometry, if a polygon, is allowed to have holes iff the third argument is set to true. The SRID value of the output GEOMETRY value is equal to that of the input GEOMETRY value. An error is returned if the length ratio is not between 0 and 1, inclusive.

The length ratio determines a threshold based on the range between the shortest and longest edges in the Delaunay triangulation of the input points. Edges longer than this threshold are removed from the triangulation. The remaining triangles define the concave hull. For areal input geometries (polygons or multipolygons), the algorithm uses a constrained Delaunay triangulation. The resulting concave hull respects the input GEOMETRY value and includes its original polygons.

Examples

SQL
> SELECT st_astext(st_concavehull(st_geomfromtext('MULTIPOINT(0 0,10 0,10 10,0 10,1 1,1 5,1 9,5 1,9 9,9 1,9 5,5 9)'), 1));
POLYGON((0 0,0 10,10 10,10 0,0 0))

> SELECT st_astext(st_concavehull(st_geomfromtext('MULTIPOINT(0 0,10 0,10 10,0 10,1 1,1 5,1 9,5 1,9 9,9 1,9 5,5 9)'), 0.8));
POLYGON((0 0,1 5,0 10,5 9,10 10,9 5,10 0,5 1,0 0))