Skip to content

bug: ST_AreaSpheroid returns wrong result sometimes #2603

@dmarczykowska

Description

@dmarczykowska

Expected behavior

ST_AreaSpheroid should return the area of geographic polygons on a spheroid. The results should be almost the same as ST_Area with the use_spheroid=true flag from PostGIS, and also almost the same as ST_Area called on projected geometry and scaled by the projection scale.

Actual behavior

In most cases, this works well. However, sometimes, very rarely, the result is incorrect, mainly in the case of more complex geometries. The result is sometimes too low and sometimes too high. The error can even be as high as 75%. I have not found any specific cause or specific features of the geometry that cause problems.
I am attaching a csv file with a few examples of problematic geometries and their areas on the spheroid obtained from sedona and postgis.

geometry_where_elips_elips_area_diff_is_significant_postgis_sed_202601281332.csv

Settings

Sedona version = 1.8.1

Apache Spark version = 3.5

API type = Python

Scala version = 2.12

Python version = 3.10

Environment = Azure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions