# Uncaught TypeError: Cesium.DistanceDisplayCondition is not a constructor

**URL:** <https://community.cesium.com/t/uncaught-typeerror-cesium-distancedisplaycondition-is-not-a-constructor/7311>\
**Category:** CesiumJS\
**Created:** [August 17, 2018, 8:40pm UTC](https://community.cesium.com/t/uncaught-typeerror-cesium-distancedisplaycondition-is-not-a-constructor/7311 "2018-08-17T20:40:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_D1](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jason\_D1](https://community.cesium.com/u/Jason_D1)\
**Post date:** [August 17, 2018, 8:40pm UTC](https://community.cesium.com/t/uncaught-typeerror-cesium-distancedisplaycondition-is-not-a-constructor/7311/1 "2018-08-17T20:40:21Z")

</div>

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

I am developing an MVC app and am getting this Uncaught TypeError error when I add: distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 6000000)

to my labels.

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

This is from the javascript file the cshtml page references:

Geocodes.forEach(element =\> {  
viewer.entities.add({  
position: new Cesium.Cartesian3.fromDegrees(element[0], element[1], 1000),  
point: {  
pixelSize: 10,  
color: Cesium.Color.BLUE,  
outlineColor: Cesium.Color.WHITE,  
outlineWidth: 3  
},  
label: {  
id: element[3],  
text: element[2],  
font: ‘20pt monospace’,  
style: Cesium.LabelStyle.FILL\_AND\_OUTLINE,  
outlineColor: Cesium.Color.BLACK,  
outlineWidth: 2,  
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,  
horizontalOrigin: Cesium.HorizontalOrigin.LEFT,  
distanceDisplayCondition: new Cesium.DistanceDisplayCondition(0, 6000000)  
}  
})

If I comment out the distanceDisplayCondition, everything works as intended. If I leave it like this, Chrome throws the error: Uncaught TypeError: Cesium.DistanceDisplayCondition is not a constructor

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

I only want to labels to show when I zoom in on them. I am zooming in on different parts of the globe and leaving it on a loop, I only want the labels to show when it is their turn.

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

I pulled the code from [https://github.com/jumpinjackie/cesium-dotnet-examples/tree/master/CesiumAspNetDemo/Views/Demo](https://github.com/jumpinjackie/cesium-dotnet-examples/tree/master/CesiumAspNetDemo/Views/Demo). I made some adjustments to the html and javascript files. Using an MSI laptop (powerful) and am getting errors in Chrome, Firefox and Edge.

Firefox:

SCRIPT445: SCRIPT445: Object doesn’t support this action  
Edge:  
TypeError: Cesium.DistanceDisplayCondition is not a constructor[Learn More]

Chrome:

test.js:81 Uncaught TypeError: Cesium.DistanceDisplayCondition is not a constructor

---

<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 20, 2018, 12:46pm UTC](https://community.cesium.com/t/uncaught-typeerror-cesium-distancedisplaycondition-is-not-a-constructor/7311/2 "2018-08-20T12:46:07Z")

</div>

Looking at the repo, it looks like they’re using an old version of Cesium (from 2015):

[https://github.com/jumpinjackie/cesium-dotnet-examples/blob/master/CesiumAspNetDemo/Scripts/Cesium/Cesium.js](https://github.com/jumpinjackie/cesium-dotnet-examples/blob/master/CesiumAspNetDemo/Scripts/Cesium/Cesium.js)

That property was added to Billboards in 2016 ([in this commit I believe](https://github.com/AnalyticalGraphicsInc/cesium/commit/28bf84cdc5c254480440a6b0251c878fcb5cd403#diff-b9af24819cacad138ec968e8a3dc5b96)).

Try updating the Cesium.js file. You can find the latest version here:

> **[Downloads | cesium.com](https://cesium.com/downloads/)**
>
> Cesium is geospatial. Use Cesium ion's simple workflow to create 3D maps of your geospatial data for visualization, analysis, and sharing. For developers, use the open-source CesiumJS library to create custom 3D mapping apps.

This should fix it.

---

<div class="post-metadata">

**Author:** ![Jason\_D1](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jason\_D1](https://community.cesium.com/u/Jason_D1)\
**Post date:** [August 20, 2018, 1:01pm UTC](https://community.cesium.com/t/uncaught-typeerror-cesium-distancedisplaycondition-is-not-a-constructor/7311/3 "2018-08-20T13:01:38Z")

</div>

You were spot on with that. New Cesium.js file and adjusted the .css files required. Everything working as intended!
