-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Invert s2 loop instead of rebuilding #4782
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.
Thanks for your contribution @sams96. Could you please add a test case for this that was failing earlier and now passes after your change?
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @manishrjain and @pawanrawal)
To show that inverting the loop makes a difference.
I was using loopFromPolygon in my own project and I noticed a weird issue with some polygons which results in the contains query always returning true, using Invert instead of rebuilding the loop here seems to fix it.
@pawanrawal Test added, not sure if I need to add some kind of legal statement for the test data I added though, It comes from natrual-earth-vector and is public domain so I think it's ok. |
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.
Thanks @sams96. Its been a long time since I looked at this piece of code so please give me a couple of days to get back to you.
Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on @manishrjain)
@pawanrawal cool thanks. I've noticed through working on some of my own projects that creating the s2 loops is very slow, I just managed to get a Edit: 10x -> 100x |
1 similar comment
Thanks @CLAassistant |
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.
@pawanrawal Are you reviewing this? Looks like a nice PR.
Reviewable status: 0 of 3 files reviewed, all discussions resolved (waiting on @manishrjain)
Went ahead and accepted the PR, considering @pawanrawal is busy with other things. Thanks for your contribution, @sams96 . Happy to accept other PRs related to geo stuff, if you're interested in contributing. |
I was using loopFromPolygon in my own project and I noticed a weird issue with some polygons which results in the contains query always returning true, using Invert instead of rebuilding the loop here seems to fix it. To reproduce, open a clean dgraph instance and push this mutation:
Which uses the 1:110m outline of Sudan from http://naturalearthdata.com/. Then the query:
Using any coordinates will always return that node.
This change is