Remove Geojson By URL.

Is there any way to remove a geojson loaded by using its url.I tried a way to remove geojson it worked (Sandcastle example link).But i want to remove the geojson by using its url. Is that possible.I tried one more way to remove the geojson but it failed (sandcastle example2 link) what could be the reason.Please provide me suggestions.

Notice the return value stated in the doc here:

https://cesiumjs.org/Cesium/Build/Documentation/GeoJsonDataSource.html#.load

It’s a promise, so you’ve have to use .then() to get the returned datasource from it.

You can get a datasource by its index if you know it:

https://cesiumjs.org/Cesium/Build/Documentation/DataSourceCollection.html?classFilter=DataSource#get

And then remove it that way. Otherwise, you could use a JavaScript dictionary to store references to the datasource so you can retrieve and remove them by their URL.