Skip to content

@turf/centroid does not take the earth curvature into account #2758

@hadbn

Description

@hadbn

The implementation of @turf/centroid is not taking the earth curvature into account.

Thus, the result is wrong when calculating the centroid of "big" polygons, or at high altitudes.

Reproduced with Turf version 7.1 running at https://turf-sandbox.netlify.app/ with the following code :

const p = turf.point([-30., 50.]);
const circ = turf.circle(p, 4000)
const p2 = turf.centroid(circ)

return turf.featureCollection([p,p2]);

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions