# Is ClampToGround not supported for Billboards in CZML?

**URL:** <https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257>\
**Category:** CesiumJS\
**Created:** [August 5, 2018, 11:06pm UTC](https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257 "2018-08-05T23:06:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://community.cesium.com/u/Jonathan_Hall)\
**Post date:** [August 5, 2018, 11:06pm UTC](https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257/1 "2018-08-05T23:06:29Z")

</div>

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

Attempting to add “heightReference” : Cesium.HeightReference.CLAMP\_TO\_GROUND, to Billboard options in CZML,

TypeError: Cannot read property ‘length’ of undefined

the full error is

TypeError: Cannot read property ‘length’ of undefined

at processProperty (Cesium.js:137465)

at processPacketData (Cesium.js:137603)

at Array.processBillboard (Cesium.js:138107)

at processCzmlPacket (Cesium.js:138685)

at Function.CzmlDataSource.\_processCzml (Cesium.js:139063)

at loadCzml (Cesium.js:138797)

at Cesium.js:138778

at Promise.then (Cesium.js:1163)

at when (Cesium.js:1026)

at load (Cesium.js:138777)

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

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?src=CZML%20Billboard%20and%20Label.html&label=CZML)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

insert on Line #11: “heightReference” : Cesium.HeightReference.CLAMP\_TO\_GROUND,

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

I am trying to animate a GPX tracklog using Billboard entities to represent the '“breadcrumb trail”. A better way night have been to include native support for GPX files in Cesium, if that project by Andre Nunes had ever been merged into master… then I wouldn’t struggle writing code to generate a CzmlDataSource from the GPX XML, which works great until I attempt to ClampToGround.

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

Cesium v1.4.8, Windows 7, Chrome

---

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://community.cesium.com/u/Jonathan_Hall)\
**Post date:** [August 5, 2018, 11:48pm UTC](https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257/2 "2018-08-05T23:48:52Z")

</div>

(NOT “heightReference”, which is usually the proper syntax)

However, the billboard still disappears underground at certain times&places when the GPS Z elevation value is less than the Z value of Cesium World Terrain.

Which leads me back to the original question,

Is ClampToGround not supported for Billboards in CZML?

The AGI logo graphic disappears underground in

> **[Cesium Sandcastle](https://sandcastle.cesium.com/?src=CZML%20Billboard%20and%20Label.html&label=CZML)**
>
> The Cesium Sandcastle provides an interactive environment for testing Cesium code.

when you paste the following line #11

“HeightReference”: Cesium.HeightReference.CLAMP\_TO\_GROUND,

change to Cesium World Terrain in the Basemap Picker and zoom in on the AGI logo.

Thanks-

-Jon

I solved the “TypeError: Cannot read property ‘length’ of undefined”, after reading [https://github.com/AnalyticalGraphicsInc/cesium/blob/1.48/Source/DataSources/CzmlDataSource.js](https://github.com/AnalyticalGraphicsInc/cesium/blob/1.48/Source/DataSources/CzmlDataSource.js) and realizing that in a CZML document, I **need to capitalize “HeightReference”** : Cesium.HeightReference.CLAMP\_TO\_GROUND,

---

<div class="post-metadata">

**Author:** ![Scott\_Hunter](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_hunter/32/2006_2.png) [@Scott\_Hunter](https://community.cesium.com/u/Scott_Hunter)\
**Post date:** [August 6, 2018, 12:58pm UTC](https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257/3 "2018-08-06T12:58:55Z")

</div>

The correct syntax in CZML is:

“heightReference”: “CLAMP\_TO\_GROUND”

[sandcastle example](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=jVVbc6JKEP4rU76YVLkg3s0a6yAqq/ESR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930fLvewib+6PSlZeTBHLX3LUwV7Ilo/mx4ybCNCyLo5Ihe/+7kklEB9aF9n34DKD5gq51r5u7TX9B3uBzyIQM3IhCGKEvIBAHrxoxOYGRYIZhhmkJb4DWhZOALaueZbOWfE0mgSGIdfYMSEafuV90W6J3P4MlnHB1JnyrweBu8zEldqjg1AQ+A7mx79Rke8TA7JPN67pvw)

The CZML property names for billboards are listed here:

[https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Billboard](https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/Billboard)

and the string values for the HeightReference type are listed here:

[https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HeightReferenceValue](https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/HeightReferenceValue)

---

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://community.cesium.com/u/Jonathan_Hall)\
**Post date:** [August 6, 2018, 1:08pm UTC](https://community.cesium.com/t/is-clamptoground-not-supported-for-billboards-in-czml/7257/4 "2018-08-06T13:08:57Z")

</div>

Thank you, Scott!
