turf icon indicating copy to clipboard operation
turf copied to clipboard

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

Open adoin opened this issue 5 months ago • 1 comments

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.

adoin avatar Mar 13 '24 14:03 adoin