How to remove all kml files?


I used dragdrop feature for adding kml files to viewer . i will use a button for removing kml files . how can i remove them ? also there is other entities in viewer that i will not to they removed by this button.

Hi @mohamad,

Thank you for your question. If I’m not mistaken, you should be able to use the method destroy() of KmlDataSource. Here is the documentation for your reference.


Thank you much

how can i use the distory() ? Is there any example ?

I receive this error : Cesium.KmlDataSource.distroy is not a function .

It’s destroy(), spelling error.

You could remove it via DataSourceCollection#remove(), see: DataSourceCollection - Cesium Documentation.

like this:


Hi @Gu-Miao! Nice catch :sweat_smile: