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
Update boolean-point-in-polygon to use point-in-polygon-hao library #1893
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks cleaner than when you started! Perf benefits are nice as well.
Is the boundary stuff better served by explicitly asking for point-on-ring? Or is there a reason to do it at the same time as the polygon? In any case if we wanted to be mindful of API breaks we could file a ticket, give it a breaking label, and assign it to the next major milestone (which might require some clean up of the existing v7 stuff).
Does changing ignoreBoundary
to something like boundary = "in" | "out" = "in"
and possibly changing the return value to 0/1/2 depending on the boundary. Still castable to a boolean easily. I might be misunderstanding the details of the boundary thing.
I reckon let's leave the API change till later until we've got a bit more of a rhythm and we might identify other breaking changes to tackle at the same time. Re a seperate point-on-ring module we already have |
Any news on this? I don't see why it was not merged already since the current implementation does not detect boundary nodes correctly and is slower... |
This just needs a new release from the point-in-polygon-hao module for rowanwins/point-in-polygon-hao#14 and then it should be ready to merge. |
Just released v1.1.0 for point-in-polygon-hao |
@rowanwins any idea why this does not address #1755 and #2048? They both have points that appear to not be in their polygons, but they return true on the current version of this branch. Here's the two tickets as tests:
|
@mfedderly this is one of the quirks of projecting coords onto a map using WebMercator. Attached is a pic showing the first case from a planar geometry viewer QGIS also shows similar when rendering the points using WGS84. The existing implementation in master returns the same thing so I don't think we've got any regression. I must admit you had me very concerned for 20 mins. 🎢 of emotions like 😭 then 😌 |
@rowanwins I'm going to get this merged. If you want to add more behavior changes to ignoreBoundary/reportOnBoundary before 7.0.0 releases, either file a PR, or an issue in the 7.0 milestone. |
npm test
at the sub modules where changes have occurred.npm run lint
to ensure code style at the turf module level.This PR updates boolean-point-in-polygon module to use the
point-in-polygon-hao
library which is more robust and faster than the current implementation.I'm also wondering if we want to tweak the API a little - we currently have an option called
ignoreBoundary
which modifies how we handle the result. However I'm wondering if we should actually provide an option that allows us to report a point lying on the boundary because there may be scenarios where that is helpful to know, however it seems. a bit clunky to have another option thats calledreportOnBoundary
... so I'm open to ideas on if and how we might tackle that. Any changes here might also be potentially breaking so we'd need to consider that...Benchmarks