turf.area() produces different results when redundant points are added
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 10.5k
- Forks
- 1k
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 4
Description
If polygon A shares a partial boundary of a larger polygon B, but is otherwise completely inside polygon B, turf.area() will give a different result for the dissolved result of A and B than B alone.
turf.area(turf.dissolve(A,B)) != turf.area(B)
This can be fixed by running turf.cleanCoords() on the dissolved polygon, at least in initial testing. I will put up an Observable notebook for testing soon.
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 by reproducing the area difference with the polygon setup described for turf.area() and turf.dissolve(), then compare the dissolved result with turf.cleanCoords(). The linked Observable notebook is not present, so establish a minimal reproducible case first; done means the dissolved result matches polygon B's area and the regression is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100