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

incorrect response for inside function #19

Open
Madanian opened this issue Feb 18, 2024 · 1 comment
Open

incorrect response for inside function #19

Madanian opened this issue Feb 18, 2024 · 1 comment

Comments

@Madanian
Copy link

Madanian commented Feb 18, 2024

      const coordinate = [
                  [51.65906944711844, 32.644344469605144],
                  [51.643474062027934, 32.64597280574026],
                  [51.6602114368668, 32.658994206590506],
                  [51.64382208072604, 32.65965256535195],
                  [51.65906944711844, 32.644344469605144],
                ];

      const point = [51.6476999685446, 32.65383784687809]

      const hao = inside(point, coordinate)
      console.log(`hao gives: ${hao}`) 

for this code, the function should returns true but it returns false! it means the response is incorrect.
samely I have this bug when I use turf.booleanPointInPolygon
do you have any suggestion for me? it is very important for me

@rowanwins
Copy link
Owner

Hi @Madanian

So it looks like the polygon you've provided contains self-intersections.
geojson io | powered by Mapbox 2024-02-19 19-46-55

In theory this algorithm is supposed to work with those sorts of polygons but it doesn't appear to be working in this case - not sure why sorry.

Regards,
Rowan

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

No branches or pull requests

2 participants