CZML remove polygon is not working

I need to remove previoud polygon and add a new polygon to map.
Data is updating but, it is not getting earsed from map.

I have created one cesium sandcastle link(cesium sandcastle).

I have a requirement to get the data from API and update the polygon on map in a loop(but it always erase the previous polygon).

Please check and help to fix this.

Your code appears to be removing the polygon CZML when adding the new circles, is that correct?


This may be easier to do through the Entity API, where you can just add the new entities as needed. Otherwise if you’re using CZML, make sure to use process instead of load so you don’t clear any previously added objects:

Thank you omar for the reply.
I got it working with process and callback of datasource.


czmlSource.process(czml).then(function(dataSource) {
var _sources = dataSource;
if( == “CZML Geometries”){
map.dataSources.remove(map.dataSources.get(0), true);

1 Like