st_distancesphere
Preview
This feature is in Public Preview.
Returns the spherical distance (in meters) between two point geometries, measured on a sphere whose radius is the mean radius of the WGS84 ellipsoid.
For the corresponding Databricks SQL function, see st_distancesphere function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_distancesphere(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The first Geometry value. |
|
| The second Geometry value. |
Notes
The two geometries are expected to have the same SRID value. The coordinates of the two point geometries are expected to be longitudes and latitudes in degrees, in that order.
Examples
Python
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions.builtin import round
df = spark.createDataFrame([('POINT(2 3)','POINT ZM (6 7 23 1000)',)], ['wkt1', 'wkt2'])
df.select(round(dbf.st_distancesphere(dbf.st_geomfromtext('wkt1'), dbf.st_geomfromtext('wkt2')), 3).alias('result')).collect()
Output
[Row(result=627753.245)]