-
Notifications
You must be signed in to change notification settings - Fork 942
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
discrepancy between code and documentation for union #1669
Comments
I've been making use of union recently and passing in multiple polygons like so: const newGeometryFeature = union(...geometryFeatures); It seems to be combining more than two polygon features together. But looking at the code in master, it seems like it only takes two? Kinda weird... Does the master code and released version not align? I'm using |
That's what I tried the first time because of the documentation, but it failed, confused why I diged into the source code to find that it only takes two feature arguments. Instead I had use union inside an Array.reduce function to get the same affect.
Yeah that's what I'm very confused about too! |
Hi @andrewharvey & @lostpebble Sorry for the confusion. Some of those docs are probably reflectively of the change from In v7 I've implemented |
This almost seems like a regression. Is there a way to get a union of a MultiPolygon with Turf.js? |
Docs and code are now in sync. It's still on my radar to relook at adding support for more than 2 polys. |
The JSDoc for turn.union at https://github.com/Turfjs/turf/blob/master/packages/turf-union/index.ts says:
However the online documentation at http://turfjs.org/docs/#union says:
which is wrong, as union only takes two polygons, as two arguments, not any number of polygons as the live documentation suggests.
I'm not sure where I need to place the PR to fix this, given it's already fixed in master.
The text was updated successfully, but these errors were encountered: