Turfjs / Turfjs/turf

booleanPointInPolygon: ignoreBoundary option is ambiguous

Open
#2,287 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

  • turf version: 6.5.0

the result of the following code is false false while point (1.5,1.5) is mathematically on the boundary of the polygon.

const pt = turf.point([1.5, 1.5]);
    const poly = turf.polygon([[
      [0, 0],
      [1, 0],
      [2, 1],
      [1, 1],
      [0, 0],
    ]]);
    const a = turf.booleanPointInPolygon(pt, poly, { ignoreBoundary: true });
    const b = turf.booleanPointInPolygon(pt, poly, { ignoreBoundary: false });
    console.log(a);
    console.log(b);

I guess you mean something else by 'boundary' and perhaps you mean vertices defining the polygon. It sounds ambiguous by the way.

Capture

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 JavaScript snippet at the booleanPointInPolygon entry point and inspect how ignoreBoundary is interpreted for the reported polygon. Done means the boundary semantics are unambiguous and the behavior for both option values matches that definition, with coverage for the reported case.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.