centerOfMass is incorrectly calculated across the antemeridian
Open
Nobody has claimed this yet.
@turf/center-of-mass
antimeridian
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
If you have points spanning the antemeridian it calculates the centre of mass as close to the meridian.
For example
centerOfMass(featureCollection([point([179, 0]), point([-177, 0])]));
Should return [-179,0] but actually returns [1,0] (ironically in this case the furthest possible point from the true CoM)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the centerOfMass implementation and reproduce the reported featureCollection with points [179, 0] and [-177, 0]. The fix is done when this antimeridian-spanning example returns [-179, 0] rather than [1, 0], with equivalent behavior preserved for ordinary points.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100