Turfjs / Turfjs/turf

booleanValid does not validate exteriors with only '1' point intersect

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

Nobody has claimed this yet.

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:

  • v6.5.0
  • multipolygon-touch.geojson
  • Snippet of source code or for complex examples use jsfiddle.
    The function is supposed to "... check if the geometry is a valid according to the OGC Simple Feature Specification."
    according to L10, turfJS/b-valid and the standard states "2. The Boundaries of any 2 Polygons that are elements of a MultiPolygon may not ‘cross’ and may touch at only a finite number of points. (Note that crossing is prevented by assertion 1 above).
    ∀ M ∈ MultiPolygon, ∀ Pi, Pj ∈ M.Geometries(), ∀ ci ∈ Pi.Boundaries(), cj ∈ Pj.Boundaries()
    ci ∩ cj = {p1, ….., pk | pi ∈ Point, 1 <= i <= k}"
    and multipolygon-touch.geojson touches apparently only in one point ('finite number of points), I conclude that we need to change the code to let this case pass.

I am using/developing the dart port of the packages. Do you also get a test failure in this case? I believe you should as https://github.com/Turfjs/turf/blob/2dd2ef88c44d847989fa0b82089f3f81fe433b83/packages/turf-boolean-valid/index.ts#L117 returns false even if there is only 1 intersecting point. (which is finite I believe)

Att: @lukas-h

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 with packages/turf-boolean-valid/index.ts, especially the intersection check around line 117, and the referenced packages/turf-boolean-valid/test/true/MultiPolygon/multipolygon-touch.geojson fixture. Run the boolean-valid tests to reproduce the failure and compare the fixture's one-point contact with the OGC rule. Done means the fixture is accepted without regressing existing validity cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.