st_perimeter
Preview
This feature is in Public Preview.
Returns the perimeter of the input geography or geometry.
For the corresponding Databricks SQL function, see st_perimeter function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_perimeter(col=<col>)
Parameters
Notes
If the input is a geometry, Cartesian length is returned (in the unit of the input coordinates). If the input is a geography, length on the WGS84 spheroid is returned (expressed in meters).
Examples
Python
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions.builtin import round
df = spark.createDataFrame([('POLYGON((0 0,50 0,50 50,0 50,0 0),(20 20,25 30,30 20,20 20))',)], ['wkt'])
df.select(round(dbf.st_perimeter(dbf.st_geomfromtext('wkt')), 2).alias('result')).collect()
Output
[Row(result=232.36)]