Skip to main content

st_concavehull

Preview

This feature is in Public Preview.

Returns the concave hull of the input geometry as a geometry using the specified length ratio.

For the corresponding Databricks SQL function, see st_concavehull function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_concavehull(col1=<col1>, col2=<col2>, col3=<col3>)

Parameters

Parameter

Type

Description

col1

pyspark.sql.Column or str

A Geometry value.

col2

pyspark.sql.Column or float

A double value between 0 and 1, inclusive, representing the length ratio used to compute the concave hull.

col3

pyspark.sql.Column or bool

An optional boolean value, indicating whether the output geometry, if a polygon, is allowed to have holes. The default value is False.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('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)], ['wkt','ratio'])
df.select(dbf.st_astext(dbf.st_concavehull(dbf.st_geomfromtext('wkt'), 'ratio')).alias('result')).collect()
Output
[Row(result='POLYGON((0 0,1 5,0 10,5 9,10 10,9 5,10 0,5 1,0 0))')]