# 1.37 Geojson removal as datasource from promise?

**URL:** <https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892>\
**Category:** CesiumJS\
**Created:** [January 14, 2019, 12:47am UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892 "2019-01-14T00:47:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_smith](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@john\_smith](https://community.cesium.com/u/john_smith)\
**Post date:** [January 14, 2019, 12:47am UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892/1 "2019-01-14T00:47:17Z")

</div>

I am loading a geojson datasource on 1.37 when I go to remove the entries and lines affiliated with this geojson all the labels and other entities are removed but the lines, I understand their is something like trying to remove a promise and I am a bit confused could someone help with the function to make it where it can be removed?  
function rd() {  
var pipes = Cesium.GeoJsonDataSource.load('pipe.geojson', {  
&nbsp;&nbsp;&nbsp;&nbsp;stroke: Cesium.Color.BLUE.withAlpha(0.5),  
&nbsp;&nbsp;&nbsp;&nbsp;fill: Cesium.Color.BLUE.withAlpha(0.5),  
&nbsp;&nbsp;&nbsp;&nbsp;strokeWidth: 3  
});  
pipes.then(function(dataSource) {  
&nbsp;&nbsp;&nbsp;viewer.dataSources.add(dataSource);  
&nbsp;&nbsp;&nbsp;var entities = dataSource.entities.values;  
&nbsp;&nbsp;&nbsp;for (var i = 0; i \< entities.length; i++) {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var entity = entities[i];  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var positions = entity.polyline.positions.getValue(viewer.clock.currentTime);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var boundingSphere = Cesium.BoundingSphere.fromPoints(positions);  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var origin = boundingSphere.center;  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;viewer.entities.add({  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position : origin,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;label : {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;text : entity.name,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;verticalOrigin : Cesium.VerticalOrigin.BASELINE  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;font : '4pt monospace',  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;style: Cesium.LabelStyle.FILL,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;color: Cesium.Color.BLUE,  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}  
});  
}

---

<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:** [January 14, 2019, 2:25pm UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892/2 "2019-01-14T14:25:09Z")

</div>

Can you show the code you’re using to remove the entities?

---

<div class="post-metadata">

**Author:** ![john\_smith](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@john\_smith](https://community.cesium.com/u/john_smith)\
**Post date:** [January 14, 2019, 3:33pm UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892/3 "2019-01-14T15:33:26Z")

</div>

function rmall() {viewer.entities.removeAll(); }

---

<div class="post-metadata">

**Author:** ![john\_smith](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@john\_smith](https://community.cesium.com/u/john_smith)\
**Post date:** [January 14, 2019, 3:34pm UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892/4 "2019-01-14T15:34:03Z")

</div>

function rmall() {viewer.entities.removeAll(); }

---

<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:** [January 14, 2019, 7:23pm UTC](https://community.cesium.com/t/1-37-geojson-removal-as-datasource-from-promise/7892/5 "2019-01-14T19:23:37Z")

</div>

That should be removing all entities, so it might be a bug if it’s not.

Are you able to reproduce this on Sandcastle? ([https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/)) if so, can you share a link to it? (Click “Share” at the top and post the link here).
