# DistanceDisplayConditionGeometryInstanceAttribute with Polyline Primitive

**URL:** <https://community.cesium.com/t/distancedisplayconditiongeometryinstanceattribute-with-polyline-primitive/7422>\
**Category:** CesiumJS\
**Created:** [September 12, 2018, 9:44am UTC](https://community.cesium.com/t/distancedisplayconditiongeometryinstanceattribute-with-polyline-primitive/7422 "2018-09-12T09:44:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ulrich\_Lehner](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ulrich_lehner/32/3135_2.png) [@Ulrich\_Lehner](https://community.cesium.com/u/Ulrich_Lehner)\
**Post date:** [September 12, 2018, 9:44am UTC](https://community.cesium.com/t/distancedisplayconditiongeometryinstanceattribute-with-polyline-primitive/7422/1 "2018-09-12T09:44:56Z")

</div>

Hello!

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

I’m trying to get _DistanceDisplayConditionGeometryInstanceAttribute_ to work with polyline arrow primitives to render a big amount of polyline arrows. This is not working as Cesium will throw a RuntimeError. I haven’t found any examples on how to do this and therefore I’m not sure if I’m using it wrong, it’s not supported, a bug etc.

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

The Sandcastle code below will throw some vertex shader compile error (“RuntimeError: Vertex shader failed to compile. Compile log: ERROR: 0:166: ‘assign’ : cannot convert from ‘highp 2-component vector of float’ to ‘Position highp 4-component vector of float’”):

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var arrowMaterialAppearance = new Cesium.PolylineMaterialAppearance(  
{  
material: Cesium.Material.fromType(  
Cesium.Material.PolylineArrowType,  
{  
color: Cesium.Color.RED  
}  
),  
translucent: false  
}  
);

var startPosition = Cesium.Cartesian3.fromDegrees(16, 46, 500);

var endPosition = Cesium.Cartesian3.fromDegrees(16.1, 46.1, 500);

var geometryInstance = new Cesium.GeometryInstance({  
geometry: new Cesium.PolylineGeometry({  
positions: [startPosition, endPosition],  
width: 5  
}),  
attributes: {  
show: new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(  
100.0,  
10000.0  
)  
}  
});

var primitive = viewer.scene.primitives.add(  
new Cesium.Primitive({  
geometryInstances: [geometryInstance],  
appearance: arrowMaterialAppearance  
})  
);

var rectangle = Cesium.Rectangle.fromDegrees(15.9, 46.2, 16.2, 45.9);  
viewer.camera.flyTo({  
destination: rectangle  
});

``

It’s caused by by these lines:

> show: new Cesium.DistanceDisplayConditionGeometryInstanceAttribute(

> 100.0,

> 10000.0

> )

If this is removed the polyline is rendered correct.

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

There are a lot of arrows to be rendered and not all should be shown at once - only when a user zooms into an area. I’m able to achieve this behavior by showing the polyline primitives based on the camera altitude. However, this is not optimal, e.g. when viewing at a flat angle arrows in the distance are also rendered.

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

Cesium 1.49.0

OS: macOS 10.13.6

Browsers: Chrome 69 / Safari 11.1.2

---

<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:** [September 13, 2018, 3:23pm UTC](https://community.cesium.com/t/distancedisplayconditiongeometryinstanceattribute-with-polyline-primitive/7422/2 "2018-09-13T15:23:34Z")

</div>

Looks like this is an error in our docs! The `show` attribute has to be called `distanceDisplayCondition` instead. That should resolve it.

I opened a PR to fix this in the docs ([https://github.com/AnalyticalGraphicsInc/cesium/pull/7038](https://github.com/AnalyticalGraphicsInc/cesium/pull/7038)). Thanks for pointing this out!

---

<div class="post-metadata">

**Author:** ![Ulrich\_Lehner](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/ulrich_lehner/32/3135_2.png) [@Ulrich\_Lehner](https://community.cesium.com/u/Ulrich_Lehner)\
**Post date:** [September 18, 2018, 8:00am UTC](https://community.cesium.com/t/distancedisplayconditiongeometryinstanceattribute-with-polyline-primitive/7422/3 "2018-09-18T08:00:54Z")

</div>

Thanks! This solves it.
