# Is there a way to clamp to ground a CZML path

**URL:** <https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207>\
**Category:** CesiumJS\
**Created:** [February 24, 2017, 10:57am UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207 "2017-02-24T10:57:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pauligree](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@Pauligree](https://community.cesium.com/u/Pauligree)\
**Post date:** [February 24, 2017, 10:57am UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207/1 "2017-02-24T10:57:01Z")

</div>

Hi everybody,  
I need to plot an animated path on Cesium. I sow that the right approach is to build a CZML datasource from my DB.

The db contains only time, lat and long datas. The only thing I can’t manage is the calculation of the altitude of every point starting from lat & long couple.

Some suggestion?

Thank you very much

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [February 24, 2017, 2:06pm UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207/2 "2017-02-24T14:06:57Z")

</div>

I’m not sure I understand what the problem is. Shouldn’t the height be 0 for each point?

-Hannah

---

<div class="post-metadata">

**Author:** ![Pauligree](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@Pauligree](https://community.cesium.com/u/Pauligree)\
**Post date:** [February 25, 2017, 7:55am UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207/3 "2017-02-25T07:55:48Z")

</div>

If I set the heigh to 0 my path goes underground…

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [February 27, 2017, 2:33pm UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207/4 "2017-02-27T14:33:57Z")

</div>

Ah okay. What you’ll need to do is compute the heights for each point on the terrain using [sampleTerrainMostDetailed](http://cesiumjs.org/Cesium/Build/Documentation/sampleTerrainMostDetailed.html). Then you can save these heights in your CZML so you don’t have to recompute the height each time the line loads.

-Hannah

---

<div class="post-metadata">

**Author:** ![Pauligree](https://avatars.discourse-cdn.com/v4/letter/p/46a35a/32.png) [@Pauligree](https://community.cesium.com/u/Pauligree)\
**Post date:** [February 27, 2017, 9:48pm UTC](https://community.cesium.com/t/is-there-a-way-to-clamp-to-ground-a-czml-path/5207/5 "2017-02-27T21:48:40Z")

</div>

Thank you. I'll try
