Turfjs / Turfjs/turf

booleanOverlap incorrectly returns true for adjoining polygons

Open
#2,454 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

@turf/boolean-overlap
Dominant language
TypeScript
Stars
10.5k
Forks
1k
Avg merge
1h 11m
Merged PRs (30d)
4

Description

v 6.5.0

This may be the same bug report as #2271 (it's unclear what the intention of that report is).

But, the definition of booleanOverlap is:

returns true if their intersection set results in a geometry different from both but of the same dimension

Two polygons that share an edge (only) have an intersection set which is a line, and hence of a different dimension (1 vs 2).

But actually booleanOverlap returns true, which then makes intersect throw an error.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the v6.5.0 behavior with two polygons that share only an edge, then inspect the booleanOverlap and intersect entry points and compare their handling of intersection dimensions. Done means the adjoining-polygon case follows the documented overlap definition and intersect no longer throws because booleanOverlap reports it as an overlap.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.