# How to add CZML generated in JS on client side to the scene

**URL:** <https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253>\
**Category:** CesiumJS\
**Created:** [November 1, 2015, 11:25am UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253 "2015-11-01T11:25:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete.blacker](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@pete.blacker](https://community.cesium.com/u/pete.blacker)\
**Post date:** [November 1, 2015, 11:25am UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253/1 "2015-11-01T11:25:48Z")

</div>

Hi There,

I'm generating a CZML object in javascript using a js sgp4 propagator. However I can't seem to find out how to add this to the Cesium scene, only methods for loading CZML files.

Any help would be greatly appreciated.

Thanks,

Pete

---

<div class="post-metadata">

**Author:** ![Mark\_Erikson](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/mark_erikson/32/2024_2.png) [@Mark\_Erikson](https://community.cesium.com/u/Mark_Erikson)\
**Post date:** [November 1, 2015, 6:56pm UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253/2 "2015-11-01T18:56:09Z")

</div>

The signature for CzmlDataSource.load() says that it takes either a string or an object, so if you have a JS object that is correct CZML structure, you should be able to pass it in directly to that.

---

<div class="post-metadata">

**Author:** ![pete.blacker](https://avatars.discourse-cdn.com/v4/letter/p/34f0e0/32.png) [@pete.blacker](https://community.cesium.com/u/pete.blacker)\
**Post date:** [November 1, 2015, 10:04pm UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253/3 "2015-11-01T22:04:35Z")

</div>

Great thanks, I was hoping it was as easy as that but I hadn't found any demo doing it anywhere.

Cheers,

---

<div class="post-metadata">

**Author:** ![Jackie\_Ng](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@Jackie\_Ng](https://community.cesium.com/u/Jackie_Ng)\
**Post date:** [November 2, 2015, 12:19am UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253/4 "2015-11-02T00:19:28Z")

</div>

You can use the process() method of the CzmlDataSource, which will _add or update_ the CZML object

- Jackie

---

<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:** [November 2, 2015, 1:40pm UTC](https://community.cesium.com/t/how-to-add-czml-generated-in-js-on-client-side-to-the-scene/3253/5 "2015-11-02T13:40:38Z")

</div>

While Mark and Jackie are both correct, for performance reasons I would recommend against generating client-side CZML and instead recommend using the Entity API directly (which is what CZML processing does under the hood anyway). Generating the CZML only to immediately process is an unnecessary step.
