# Polylines in 2D

**URL:** <https://community.cesium.com/t/polylines-in-2d/440>\
**Category:** CesiumJS\
**Created:** [May 2, 2013, 4:31pm UTC](https://community.cesium.com/t/polylines-in-2d/440 "2013-05-02T16:31:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jon\_Lounsbury](https://avatars.discourse-cdn.com/v4/letter/j/df705f/32.png) [@Jon\_Lounsbury](https://community.cesium.com/u/Jon_Lounsbury)\
**Post date:** [May 2, 2013, 4:31pm UTC](https://community.cesium.com/t/polylines-in-2d/440/1 "2013-05-02T16:31:13Z")

</div>

After upgrading from B15 to B16, an exception is thrown in my app when moving to 2D if there are polylines in the scene. Here is the stack trace:

Uncaught DeveloperError: sphere is required  
Error  
&nbsp;&nbsp;&nbsp;&nbsp;at new DeveloperError ([http://localhost/MyApp/Cesium/Core/DeveloperError.js:44:22](http://localhost/MyApp/Cesium/Core/DeveloperError.js:44:22))  
&nbsp;&nbsp;&nbsp;&nbsp;at Function.BoundingSphere.clone ([http://localhost/MyApp/Cesium/Core/BoundingSphere.js:538:19](http://localhost/MyApp/Cesium/Core/BoundingSphere.js:538:19))  
&nbsp;&nbsp;&nbsp;&nbsp;at PolylineCollection.update ([http://localhost/MyApp/Cesium/Scene/PolylineCollection.js:456:45](http://localhost/MyApp/Cesium/Scene/PolylineCollection.js:456:45))  
&nbsp;&nbsp;&nbsp;&nbsp;at CompositePrimitive.update ([http://localhost/MyApp/Cesium/Scene/CompositePrimitive.js:404:23](http://localhost/MyApp/Cesium/Scene/CompositePrimitive.js:404:23))  
&nbsp;&nbsp;&nbsp;&nbsp;at Scene.render ([http://localhost/Proton/Cesium/Scene/Scene.js:497:26](http://localhost/Proton/Cesium/Scene/Scene.js:497:26))  
&nbsp;&nbsp;&nbsp;&nbsp;at declare.render ([http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1042:24](http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1042:24))  
&nbsp;&nbsp;&nbsp;&nbsp;at declare.updateAndRender ([http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1067:18](http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1067:18))  
&nbsp;&nbsp;&nbsp;&nbsp;at updateAndRender ([http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1091:24](http://localhost/MyApp/Cesium/Widgets/Dojo/CesiumViewerWidget.js:1091:24)) BoundingSphere.js:538  
BoundingSphere.clone BoundingSphere.js:538  
PolylineCollection.update PolylineCollection.js:456  
CompositePrimitive.update CompositePrimitive.js:404  
Scene.render Scene.js:497  
declare.render CesiumViewerWidget.js:1042  
declare.updateAndRender CesiumViewerWidget.js:1067  
updateAndRender CesiumViewerWidget.js:1091

It appears that a similar issue is present on the Apps deployed on this site, except that no exception is thrown, the polylines just disappear in 2D. For example, switch to 2D here:  
[http://cesium.agi.com/Cesium/Build/Apps/CesiumViewer/?source=Gallery/simple.czml](http://cesium.agi.com/Cesium/Build/Apps/CesiumViewer/?source=Gallery/simple.czml)

I noticed there was some discussion a few days ago about 2D polylines when displaying a GEO orbit track, but I looked at the commits associated with that and I think they are already in B16, and may be associated with the problem.

Thanks,  
Jon

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [May 2, 2013, 5:44pm UTC](https://community.cesium.com/t/polylines-in-2d/440/2 "2013-05-02T17:44:58Z")

</div>

Hi Jon, I’m sorry to hear you’re having problems. The Polylines went through a significant rewrite but I was hoping we found any outstanding issues. None of the machines I have access to can reproduce the problem. Can you let us know what OS/Browser/Video card you are using? Also, have you tried updating to the latest drivers available for your card? It doesn’t seem a like a graphics related problem (maybe a race condition of some kind). Does it happen every time without fail?

Thanks,

Matt

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lounsbury](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonathan\_Lounsbury](https://community.cesium.com/u/Jonathan_Lounsbury)\
**Post date:** [May 2, 2013, 6:49pm UTC](https://community.cesium.com/t/polylines-in-2d/440/3 "2013-05-02T18:49:08Z")

</div>

Matt,

Don’t ask me why, but all the sudden I am able to see the polylines in the Cesium hosted app. It could be that previously chrome was using my integrated Intel graphics card, and now it’s using my NVIDIA card since chrome was still open from when my laptop was unplugged but now it’s docked.

However, I was still getting the stack trace in my app until I tracked down the issue. The line that causes the exception is:

boundingVolume = BoundingSphere.clone(this.\_boundingVolume2D, scracthBoundingSphere)

in PolylineCollection.js. this.\_boundingVolume2D is undefined.

I have some polylines that are added to the scene (with show=false) with no positions set yet. Removing those polylines or setting their positions before adding them to the scene solves the issue. Is that the desired behavior for polylines with no positions?

Thanks!

Jon

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lounsbury](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonathan\_Lounsbury](https://community.cesium.com/u/Jonathan_Lounsbury)\
**Post date:** [May 2, 2013, 6:51pm UTC](https://community.cesium.com/t/polylines-in-2d/440/4 "2013-05-02T18:51:31Z")

</div>

You can reproduce the stack trace in the CesiumViewer app by dragging czml with polylines onto an empty instance in 2D mode.

Jon

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [May 2, 2013, 7:01pm UTC](https://community.cesium.com/t/polylines-in-2d/440/5 "2013-05-02T19:01:39Z")

</div>

Yep, starting out in 2D mode I was easily able to reproduce this now. I’ll look into a fix.

---

<div class="post-metadata">

**Author:** ![Matt\_Amato](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/matt_amato/32/1993_2.png) [@Matt\_Amato](https://community.cesium.com/u/Matt_Amato)\
**Post date:** [May 2, 2013, 11:29pm UTC](https://community.cesium.com/t/polylines-in-2d/440/6 "2013-05-02T23:29:37Z")

</div>

I opened this pull request to fix the issue (and another unrelated issue) [https://github.com/AnalyticalGraphicsInc/cesium/pull/734](https://github.com/AnalyticalGraphicsInc/cesium/pull/734)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Lounsbury](https://avatars.discourse-cdn.com/v4/letter/j/b4bc9f/32.png) [@Jonathan\_Lounsbury](https://community.cesium.com/u/Jonathan_Lounsbury)\
**Post date:** [May 3, 2013, 2:03am UTC](https://community.cesium.com/t/polylines-in-2d/440/7 "2013-05-03T02:03:05Z")

</div>

That fixed it, thank you!
