ST_GeodesicArea

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.

FunctionSyntax
Pythongeodesic_area(geometry)
SQLST_GeodesicArea(geometry)
ScalageodesicArea(geometry)

For more details, go to the GeoAnalytics Engine API reference for geodesic_area.

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

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from geoanalytics.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)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+-------------------+-------------------+
|geodesic_area      |planar_area        |
+-------------------+-------------------+
|3.49464648969709E11|3.62786023827199E11|
+-------------------+-------------------+

Version table

ReleaseNotes

1.0.0

Python and SQL functions introduced

1.5.0

Scala function introduced

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