Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

booleanContains doesn't get good result when detect an unusual polygon #2588

Open
adoin opened this issue Mar 13, 2024 · 1 comment
Open

Comments

@adoin
Copy link

adoin commented Mar 13, 2024

Please provide the following when reporting an issue:

  • [ x] The version of Turf you are using, and any other relevant versions.
    ^7.0.0-alpha.114
  • [ x] GeoJSON data as a [gist file]
const box =  {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          116.36030641999426,
          39.91345040344761
        ],
        [
          116.35987523334947,
          39.9229132365226
        ],
        [
          116.37431998594991,
          39.92252589496024
        ],
        [
          116.36734913519248,
          39.91887370878366
        ],
        [
          116.37266710381155,
          39.91516598561908
        ],
        [
          116.37185083186596,
          39.914325401230776
        ],
        [
          116.36030641999426,
          39.91345040344761
        ]
      ]
    ]
  }
}
const item = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [
      [
        [
          116.36393557425471,
          39.92003566676075
        ],
        [
          116.36479794754429,
          39.917102758606376
        ],
        [
          116.3681755762618,
          39.917158097668036
        ],
        [
          116.36882235622899,
          39.92047835887995
        ],
        [
          116.36566032083387,
          39.92119772742078
        ],
        [
          116.36393557425471,
          39.92003566676075
        ]
      ]
    ]
  }
}
  • [ x] Snippet of source code or for complex examples use jsfiddle.
    If needed I can create one tomorrow.
  • [ x] Verify this issue hasn't already been reported, or resolved in the latest alpha pre-release.

Snipaste_2024-03-13_22-12-48

How booleanContains(box, item) get true?
If I want a function to detect fully contains item. What should I do.

@smallsaucepan
Copy link
Member

Hi @adoin . The library turf uses to check this has some bugs. We are going to investigate if there is a better library we can use that will make your example work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants