Märkus.
Juurdepääs sellele lehele nõuab autoriseerimist. Võite proovida sisse logida või kausta vahetada.
Juurdepääs sellele lehele nõuab autoriseerimist. Võite proovida kausta vahetada.
Important
This feature is in Public Preview.
Returns the centroid of the input geometry as a 2D point geometry.
For the corresponding Databricks SQL function, see st_centroid function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_centroid(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
A Geography or Geometry value. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POLYGON((1 0, 0.5 0.866, -0.5 0.866, -1 0, -0.5 -0.866, 0.5 -0.866, 1 0))',)], ['wkt'])
df.select(dbf.st_astext(dbf.st_centroid(dbf.st_geomfromtext('wkt'))).alias('result')).collect()
[Row(result='POINT(0 0)')]