-
Notifications
You must be signed in to change notification settings - Fork 943
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
New module @turf/boolean-equal
#869
Conversation
Hey @stebogit Unfortunately this module isn't quite this simple. For example the following lines should pass
Shapely provides this helpful definition
So points are easy, lines and polygons need a bit more thought. Me thinks you'll probably need to start from scratch. |
@rowanwins 👍 Good catch, added that test in this module. Shapely successfully passes (True) & this current library tests fail (False) on |
[[0, 0], [2, 2]]
and
[[0, 0] [,1, 1], [2, 2]] @rowanwins @DenisCarriere the test now would pass if I could install the brand new BTW I had to fix how Please fill free to add more tests with unclean features if you like. |
packages/turf-boolean-equal/index.js
Outdated
if (!feature2) throw new Error('feature2 is required'); | ||
var type1 = getGeomType(feature1); | ||
var type2 = getGeomType(feature2); | ||
if (type1 !== type2) throw new Error('features must be of the same type'); |
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.
Why are we throwing an error, shouldn't this simply return false
?
if (type1 !== type2) return false;
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.
ahahah! yes that's right @DenisCarriere! 😅
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.
👍 Published
From my quick glance at the source and tests this doesn't support polys that have different starting vertices
So we might need a bit more thought here. |
Imported from
turf-equal
.Implements DE-9IM "equal" spatial relation.
TODOs:
Thanks @tmcw and @tcql for the original work! 👍