-
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
Cannot read property 'left' of null #36
Comments
Another case where the same exception is thrown for a different dataset: |
Furthermore, on the first dataset, if I try to narrow down which geom is causing the problems, I see this;
Not sure if that's related at all though? |
I suspect this might be related to issue #29 and I am curious about this line of code (from the fix for that bug): https://github.com/mfogel/polygon-clipping/blob/master/src/segment.js#L58 Shouldn't that be
At the moment it will return just a.isVertical, which is either true or false, and when false the compare function will thus claim the two segments are identical? Or is that actually the intention? (still wrapping my head around the algo and code) |
(note: my previous comment doesn't fix/change the issue. But it seemed odd) |
Hi @mfogel , thanks for picking this up... any ideas what the issue might be (and/or if there is a quick workaround at the moment)? We're seeing these errors crop up quite a number of times now for our end users; so keen to get a fix in place (even if it's a temporary work around) |
Hi @jliebrand , thanks for the bug report Not sure on any easy workarounds.... once I get a chance to deep dive into these shapes and understand what's going wrong I may be able to recommend a work-around. In the past rounding errors have often caused bugs like these, but looking at your shapes I see ~6 decimals not ~12, so I think rounding errors are probably not the cause of the problem, but can't say for sure at this point. I don't have time to deep dive into this today, but might this weekend. My process for debugging this will be:
I'll use this line to focus on one failing end-to-end test case at a time. I'll use tools like mapshaper.org and geojsonhint to visualize the shapes and makes sure they're well-formed. If you want to help things along, if you can fork this project, make a branch and do the first one or two steps that'll save me time. And - thanks for pointing out that bug in Cheers |
Great - I'll have a look at adding tests to cover this and try to get a minimum repro case |
Interesting - I can not reproduce the crash on master... it still crashes on the version from 30th aug (eg the released version), but it seems to work on the latest... Time for an updated release? |
It seems this commit: Fixed this problem. We have a few more errors in our logs, I will check if those are also fixed with that commit or not. And if not, put some test cases in |
I'll leave this bug open until that commit is released, but it does indeed appear to have solved the problem. There is however another bug where the input causes an infinite loop somewhere. I've raised a new issue (#38 ) and a PR to add a test case for it. |
Formed from one of the failing inputs linked on that ticket. This is broken in the latest release to npm (v0.8) but already fixed on master. Adding this test case to make sure this is covered by the test suite.
Glad to see it's already fixed! Thanks for tracking this further down @jliebrand To make sure the test suite covers this case, I added a test case to master anyway of a mostly-simplified geometry based off one of the ones you provided above, which triggers a failure on v0.8 but passes on master. I'll release a v0.9 with this fix once the other open bugs are either fixed or understood to be a enough work to justify pushing them to v0.10 |
I think I might have spoken too soon. Looks like these coordinates still cause this bug to trigger: https://gist.github.com/jliebrand/8aa87238df614d1c5d456af98fd0ad49 |
Hi @mfogel - I know you're busy, but any update on this and the other bugs? |
@jliebrand sorry for the pause. I'll make time tonight / tomorrow to review at least some of the other open bugs & PR's and release a v0.9 regardless so that at least this fix can be pushed out to npm. |
Great - thanks! |
Just released v0.9 that has the fix to this in it. |
Did you see my comment Not sure 0.9 fixes that? Unless you made another change? |
@jliebrand sorry missed your comment. I just verified it's still broken on those coordinates - reopening this bug. |
@mfogel how are things going with this (and the other) bugs? |
ps. it doesn't look like 0.9 is on npm yet? |
I think v0.9 is on npm. (there is a mistake in the README on there, it says that v0.9 is still 'in development') I should get a few hours to process through the open bugs on saturday and sunday. In general, if they turn out not to be floating-point rounding issues, they're a lot easier to fix. |
Ah great! I used npm-check to see if there was an update and it didn't report it. But that's probably because I have the module pointed directly to github. I'll have to keep that for now, as 0.9 does not have the guard against the eternal loop. But I'll update my package.json once the other bugs are fixed. |
Ok, I've reduced the error condition to applying a {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[[0.0, 1.0], [0.0, 1.04], [0.08, 1.02], [0.14, 1.04], [0.0, 1.0]]
]
}
},
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [[[0.08, 1.02], [0.0, 1.0], [0.0, 1.04], [0.08, 1.02]]]
}
}
]
} They look pretty harmless, but there are a few identical segments in those two polygons, which I suspect is triggering the bug. Stay tuned! |
Reproduce case: https://repl.it/repls/TangibleHoneydewFiber
As far as I can make out, the input geometry should be valid, but it clearly barfs on some aspect of it... Still trying find which of the polygons is causing the problem...
The text was updated successfully, but these errors were encountered: