-
Notifications
You must be signed in to change notification settings - Fork 62
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
Unable to complete output ring starting at ... #101
Comments
I have a similar simple case happening trying to union 4 squares. Code to reproduce is below: const polygonClipping = require('polygon-clipping')
const poly1 = [[
[1553.481712766874, 1494.8225115579035],
[1553.481712766874, 80.60894918480847],
[139.26815039377902, 80.60894918480824],
[139.2681503937788, 1494.8225115579032]]]
const poly2 = [[
[2130.363837219598, 1505.3523513000096],
[2130.363837219598, 91.13878892691457],
[716.1502748465028, 91.13878892691434],
[716.1502748465026, 1505.3523513000093]
]]
const poly3 = [[
[2162.7561633766086, 1808.0852438855597],
[2162.7561633766086, 393.87168151246476],
[748.5426010035136, 393.87168151246453],
[748.5426010035134, 1808.0852438855595]
]]
const poly4 = [[
[1522.2282522557293, 1767.4968190640373],
[1522.2282522557293, 353.28325669094227],
[108.01468988263434, 353.28325669094204],
[108.01468988263412, 1767.496819064037]
]]
// This succeeds
const union = polygonClipping.union(poly1, poly2, poly3)
// This fails
const union2 = polygonClipping.union(poly1, poly2, poly3, poly4) |
Actually in that example calling |
Rounding also seems to avoid this in my case, so I guess I'll just make sure I'm rounding all inputs to |
I'm guessing most of these issues are related to comparing floats directly. Probably should be doing epsEqual with a sufficiently large epsilon. |
geojsons referred to can be found at this gist
A production issue was reproduced by trying to union
source_1.geojson
andsource_2.geojson
.We found we could do the union with a Python lib.
I looked at the data and it seems like there may be some rounding noise since most of the numbers have a sequence of decimal digits
999
or000
at the 6th decimal place.I tried rounding the numbers to the 6th dec place and this could union with
polygon-clipping
.These 2 successful union results are also at the gist linked above.
Using polygon-clipping version 0.14.3 throughout this sequence of events.
I saw there is already an issue open on this error diagnostic and I honestly wasn't sure whether to post this in that thread or open a new one.
The text was updated successfully, but these errors were encountered: