# Tracking entity from CZML file

**URL:** <https://community.cesium.com/t/tracking-entity-from-czml-file/8591>\
**Category:** CesiumJS\
**Created:** [August 28, 2019, 4:15pm UTC](https://community.cesium.com/t/tracking-entity-from-czml-file/8591 "2019-08-28T16:15:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Roy](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Adam\_Roy](https://community.cesium.com/u/Adam_Roy)\
**Post date:** [August 28, 2019, 4:15pm UTC](https://community.cesium.com/t/tracking-entity-from-czml-file/8591/1 "2019-08-28T16:15:12Z")

</div>

**1. A concise explanation of the problem you’re experiencing.**

Hi all, sorry in advance for the newbie question (I’m just learning Cesium). I’ve loaded in a CZML file and am trying to use trackedEntity to make the camera follow it, but I’m running into a problem. Instead of actually following it, all my code does is zoom in on its initial position and then stay there. What am I doing wrong?

As a test, I pulled the CZML data from the CZML Path demo in Sandcastle ([https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=CZML%20Path.html&label=CZML](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/?src=CZML%20Path.html&label=CZML)), saved it as its own file, and pointed the czml variable in the code below at it; it worked perfectly. So it seems like its an issue with the CZML file I’m using, but I can’t figure out what?

**2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.**

**//my code in Cesium**

**var czml = ‘[https://cdn.glitch.com/3740b64b-2ae9-4b55-a2a2-b2d735237a25%2Fat-maine.czml?v=1566979112341](https://cdn.glitch.com/3740b64b-2ae9-4b55-a2a2-b2d735237a25%2Fat-maine.czml?v=1566979112341)’; //where I’m loading my file from**

**var viewer = new Cesium.Viewer(‘cesiumContainer’, {**

**terrainProvider : Cesium.createWorldTerrain(),**

**baseLayerPicker : false,**

**shouldAnimate : true**

**});**

**viewer.dataSources.add(Cesium.CzmlDataSource.load(czml)).then(function(ds) {**

**viewer.trackedEntity = ds.entities.getById(‘path’);**

**});**

**//A sample of my CZML file – I’ve cut out most of the coordinates, save for a sample, because it’s so long:**

[{“id”: “document”, “name”: “AT Demo”, “version”: “1.0”,

“author”: “Adam Roy”, “clock”: {“interval”:

“2019-08-28T01:14:42+00:00/2019-09-02T14:50:51+00:00”, “currentTime”:

“2019-08-28T01:14:42+00:00”, “multiplier”: 1000}}, {“id”: “path”,

“availability”:

“2019-08-28T01:14:42+00:00/2019-09-02T14:50:51+00:00”, “position”:

{“epoch”: “2019-08-28T01:14:42+00:00”, “cartographicDegrees”: [0,

-71.021238, 44.485148, 914.9, 7.0, -71.021165, 44.485176, 915.8,

21.0, -71.021009, 44.485184, 917.7, 26.0, -71.02096, 44.485213,

918.6, 44.0, -71.020767, 44.485203, 921.1, 50.0, -71.020703,

44.485225, 922.2, 70.0, -71.020525, 44.48512, 923.0, /\* coordinates removed here \*/]}, **“point”: {“color”: {“rgba”: [255, 255,**

**255, 255]}, “outlineColor”: {“rgba”: [0, 173, 253, 255]},**

**"outlineWidth": 6, “pixelSize”: 8, “heightReference”:**

**"RELATIVE\_TO\_GROUND"}}]**

**3. Context. Why do you need to do this? We might know a better way to accomplish your goal.**

I’m trying to make the camera follow a path plotted out by the CZML file

**4. The Cesium version you’re using, your operating system and browser.**

1.60, MacOS High Sierra, Chrome

---

<div class="post-metadata">

**Author:** ![Adam\_Roy](https://avatars.discourse-cdn.com/v4/letter/a/bcef8e/32.png) [@Adam\_Roy](https://community.cesium.com/u/Adam_Roy)\
**Post date:** [August 29, 2019, 5:58pm UTC](https://community.cesium.com/t/tracking-entity-from-czml-file/8591/2 "2019-08-29T17:58:36Z")

</div>

Solved. I was using the wrong variable. _headdesk_

---

<div class="post-metadata">

**Author:** ![omar](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/omar/32/1999_2.png) [@omar](https://community.cesium.com/u/omar)\
**Post date:** [August 29, 2019, 7:42pm UTC](https://community.cesium.com/t/tracking-entity-from-czml-file/8591/3 "2019-08-29T19:42:37Z")

</div>

Glad to hear you resolved it - and welcome to the Cesium community!
