ST_GeodesicDistance

ST_GeodesicDistance takes two geometry columns and returns a double column. The output column represents the geodesic distance between the two input geometries in meters. For multipoints, lines, and polygons, the distance is calculated from the nearest point between the geometries. This function is more accurate but less performant than ST_Distance and requires that a spatial reference is set on at least the first input geometry column. To learn more about the difference between planar and geodesic calculations see Coordinate systems and transformations.

If the two geometry columns are in different spatial references, the function will automatically transform the second geometry into the spatial reference of the first.

FunctionSyntax
Pythongeodesic_distance(geometry1, geometry2)
SQLST_GeodesicDistance(geometry1, geometry2)
ScalageodesicDistance(geometry1, geometry2)

For more details, go to the GeoAnalytics for Microsoft Fabric API reference for geodesic_distance.

This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.

Examples

PythonPythonSQLScala
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

from geoanalytics_fabric.sql import functions as ST, Point
from pyspark.sql import functions as F

data = [
    (Point(-2500000, 8100000), Point(-2500000, 8100000)),
    (Point(-2500000, 8100000), Point(-2501000, 8100000)),
    (Point(-2500000, 8100000), Point(-2501000, 8101000))
]

df = spark.createDataFrame(data, ["point1", "point2"])\
          .withColumn("point1", ST.srid("point1", 54008))\
          .withColumn("point2", ST.srid("point2", 54008))

df.select(F.round(ST.geodesic_distance("point1", "point2"), 0).alias("geodesic_distance")).show()
Result
1
2
3
4
5
6
7
+-----------------+
|geodesic_distance|
+-----------------+
|              0.0|
|           1000.0|
|           2486.0|
+-----------------+

Version table

ReleaseNotes

1.0.0-beta

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close