when loading kml datasource, I want to display a loading image until it can be visualized in the viewer or scene. I tried to handle:
viewer.dataSources.dataSourceAdded
event but it is fired very early, that is to say, the loading image disappears before the datasource can be visualizedthe issue is the same with
viewer.dataSources.add(datasource).then(function(){ clearLoader(); } )
Please anyone can help Thanks Regards
Try this instead:
viewer.dataSource.add(datasource); // add empty datasource.
datasource.load(url).then(function () { clearLoader(); });
The .add
function returns immediately, even with an empty data source. But the .load
function returns a promise that will resolve once the data source is loaded.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With