Turfjs / Turfjs/turf

BooleanWithin does not work correctly with (Island polygon / Doughnut).

Open
#2,595 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Please provide the following when reporting an issue:

  • Version of Turf 6.5

  • Italy geoJson file
    San Marino geoJson file

  • I am trying to use Turf's booleanWithin method to comapre two features in my dataset. When it comes to doing the check with polygons that have a hole in them, also know as Island polygon/ Doughnut, the method returns wrong results. The example used was a (Polygon,Multipolygon) => booleanWithin(San Marino, Italy) . Expecting this to return false but getting true.

Do Turf's boolean functions support Island polygons ?

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 at Turf's booleanWithin entry point and reproduce the case with the linked Italy and San Marino GeoJSON files. Check how polygon holes and multipolygons are handled, then verify that booleanWithin(San Marino, Italy) returns false while preserving existing boolean-function behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data
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.