-
Notifications
You must be signed in to change notification settings - Fork 3.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
Straight lines in GeoJSON sometimes crash with normalized result is not a number #8464
Comments
After some digging I think I've got it. In generateRhumbArc, first the number of wanted points on each line segment is computed based on distance and granularity. This is used to create an empty positions array. Now for the details, with @OmarShehata's specific example in mind: cesium/Source/Core/PolylinePipeline.js Lines 463 to 475 in deaf3df
The first segment has 10 points and the second has 6. If you put a breakpoint inside numberOfPointsRhumbLine, you can see this 6 is the result of Math.ceil(5.000000000000001) .Then generateCartesianRhumbArc is called for each segment, and starts by computing again the number of points: cesium/Source/Core/PolylinePipeline.js Lines 143 to 152 in deaf3df
The first segment still has 10 points, but this time the second one has only 5 points. Have another look at the breakpoint inside numberOfPointsRhumbLine and you'll see this 5 is the result of Math.ceil(4.999999999999999) .So the 6th position is never generated and will remain empty in the positions array. Why is there a difference? In the first time, the A simple solution that worked for me is to remove the scaling part (which is really redundant anyway), and instead to set the |
Thanks so much for digging into this @dennisadams ! It would be great if you can open a PR with that fix you suggested. |
Great, I'll try to get it done by tomorrow. |
The GeoJSON below crashes in CesiumJS:
Visualized in geojson.io.
Sandcastle link. Error produced:
But notice if you preturb the line just slightly, it renders fine:
The text was updated successfully, but these errors were encountered: