ST_GeodesicArea takes a geometry column and returns a double column. The output column contains the geodesic area of the input geometry in square meters. For point, multipoint, and linestring geometries this function will always return 0. This function is more accurate but less performant than ST_Area and requires that a spatial reference is set on the input geometry column. To learn more about the difference between planar and geodesic calculations see Coordinate systems and transformations.
Function | Syntax |
---|---|
Python | geodesic |
SQL | ST |
Scala | geodesic |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for geodesic_area.
This function implements the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Examples
from geoanalytics_fabric.sql import functions as ST, Polygon
from pyspark.sql import functions as F
data = [
(Polygon([[[202900.46, 8452626.36], [125775.16, 9047372.23], [592624.25, 9047372.23],
[956021.25, 8452626.36], [202900.46, 8452626.36]]]),)
]
df = spark.createDataFrame(data, ["polygon"])\
.withColumn("polygon", ST.srid("polygon", srid=54008))\
.withColumn("geodesic_area", F.round(ST.geodesic_area("polygon"),3))\
.withColumn("planar_area", F.round(ST.area("polygon"), 3))
df.select("geodesic_area","planar_area").show(truncate=False)
+-------------------+-------------------+
|geodesic_area |planar_area |
+-------------------+-------------------+
|3.49464648969709E11|3.62786023827199E11|
+-------------------+-------------------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |