Skip to content
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

GeoJSON with vertical line crashes #8764

Closed
silke-boehler opened this issue Apr 17, 2020 · 3 comments · Fixed by #9028
Closed

GeoJSON with vertical line crashes #8764

silke-boehler opened this issue Apr 17, 2020 · 3 comments · Fixed by #9028

Comments

@silke-boehler
Copy link

When loading the folling Sandcastle example, it will crash with following error:

An error occurred while rendering. Rendering has stopped.
undefined
DeveloperError: Expected right to be typeof object, actual typeof was undefined
Error
at DeveloperError (https://sandcastle.cesium.com/CesiumUnminified/Workers/Check-c4f3a3fc.js:62:17)
at Check.typeOf.object (https://sandcastle.cesium.com/CesiumUnminified/Workers/Check-c4f3a3fc.js:238:17)
at Cartesian3.subtract (https://sandcastle.cesium.com/CesiumUnminified/Workers/Cartesian2-a4e73c05.js:530:13)
at PolylineGeometry.createGeometry (https://sandcastle.cesium.com/CesiumUnminified/Workers/createPolylineGeometry.js:389:21)
at createPolylineGeometry (https://sandcastle.cesium.com/CesiumUnminified/Workers/createPolylineGeometry.js:523:13)
at createGeometry (https://sandcastle.cesium.com/CesiumUnminified/Workers/createGeometry.js:60:21)
at callAndWrap (https://sandcastle.cesium.com/CesiumUnminified/Workers/createTaskProcessorWorker.js:61:17)
at Anonymous function (https://sandcastle.cesium.com/CesiumUnminified/Workers/createTaskProcessorWorker.js:106:17)

The example just loads one simple GeoJSON Feature of type LineString. If I change any of the three coordinates slighty, it works

geojson_produces_error = {"type":"Feature","geometry":{"type":"LineString","coordinates":[[7.970063350393387,47.59408093341338,773.65],[7.970063350393387,47.59408093341338,765.55]]}};
geojson_this_works     = {"type":"Feature","geometry":{"type":"LineString","coordinates":[[7.970063350393387,47.59408093341338,773.650001],[7.970063350393387,47.59408093341338,765.55]]}};

Sandcastle example:

Browsers:
Google Chrome Version 80.0.3987.163
Firefox 75.0 (64-Bit)
Internet Explorer 11.719.18362.0

Operating System:
Windows 10

@OmarShehata OmarShehata changed the title Loading GeoJSON LineString crashes with some Coordinates GeoJSON with vertical line crashes Apr 17, 2020
@OmarShehata
Copy link
Contributor

I initially thought this was related to this crash which happens when you have lines that are perfectly straight (sometimes): #8464 but it looks like this issue is specific to vertical lines. Here's a Sandcastle that loads the following GeoJSON:

image

The first two points are exactly vertical. If you remove the last point, it crashes.

@OmarShehata
Copy link
Contributor

Also reported here with some additional debugging notes: #8974

@TJKoury
Copy link
Contributor

TJKoury commented Jun 23, 2020

@OmarShehata This could be related to calculating the number of points in a rhumb line; if you have two points in a polyline that differ only in altitude, then the radians distance squared tends to be zero.

For this particular case making a change will fix the issue.
[Core/PolyLinePipeline.js#L28]:(https://github.com/CesiumGS/cesium/blob/master/Source/Core/PolylinePipeline.js#L28)

return Math.max(
    1,
    Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity))));

I have not tested this for other side effects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants