Optional KML NetworkLinks resolution

Hi, I'm loading a KML With NetworkLinks.

viewer.dataSources.add(loadPromise).then(function(dataSource) {
}).otherwise(function(error) {
    showLoadError(source, error);

<Link id="Link_194679">

The Link is used only for notification, it doesn't return actual data.

GoogleEarth warns user when the link isn't available, but loads the rest of the KML and plays the tour.

I want to achive quite the same behaviour for KML in cesium, but if the Link isn't available (server returns 404 for instance) datasource promise will be rejected.

In KMLDataSource.js, in processNetworkLink for each href will be created a promise. Later all these promises combined via promise.all() in loadKML, so if KMLLink will fails the whole KML loading promise will be rejected.

I want to be able to ignore NetworkLinks fails.

Not adding NetworkLink promise to the collection of promises is not an option because it migth break the the code for NetworkLinks with actual data, because the whole data source load promise might be resolved before NetworkLink will be loaded or rejected. But for failed links that works.

Another option, which I think is the right one - is to make a warning if NetworkLink loading promise was rejeted but resolve the promise anyway.

Here is a patch for that down bellow. So if the failing of the whole KML load promise wasn't made intentionally, I'll make a pull request (or you are free to just apply that patch), and if rejection of the whole load promise is desired behaviour, how can I ignore NetworkLinks fails duiring the KML DataSource loading?

diff --git a/Source/DataSources/KmlDataSource.js b/Source/DataSources/KmlDataSource.js
index 1887346..42840ba 100644
--- a/Source/DataSources/KmlDataSource.js
+++ b/Source/DataSources/KmlDataSource.js
@@ -2188,6 +2188,8 @@ define([
                     } else if (viewRefreshMode === 'onRegion') {
                         oneTimeWarning('kml-refrehMode-onRegion', 'KML - Unsupported viewRefreshMode: onRegion');
+ }).otherwise(function(error) {
+ oneTimeWarning('An error occured during loading ' + linkUrl);



I’m not necessarily sure why the promise was rejected in that case, but your desired behavior you describe here seems sensible. Try opening the pull request, and include a summary of your reasoning. I’m sure you will get a prompt response if people disagree!



This was fixed and will be included in the Cesium 1.39 release available on November 1st.



If anyone is following this thread, a fix has been merged: https://github.com/AnalyticalGraphicsInc/cesium/pull/5871#issuecomment-338322796