Throuble loading KML with multiple NetworkLinks

Hello everyone, Im new on Cesium World and I think Its the best, and Im trying to migrate from Google Earth my Web Based application.

Actually, The application is loading map info from a main KML file with a single NetworkLink, but in that linked KML file includes much more NetworkLink to other KML, creating a big tree of NetworkLink and KML.

Im using:

  viewer.homeButton.viewModel.command();
  viewer.dataSources.add(Cesium.KmlDataSource.load('url_to_my_KML.kml'));

The KML loaded look like:

<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
    <Document id="feat_22023">
        <NetworkLink id="feat_22024">
            <Link>
            <href>url_to_other_KML_file.kml</href>
            </Link>
        </NetworkLink>
    </Document>
</kml>

and goes on!!!

When I run the page, It began to get all the KML resources:

This is what i get on Console:

...
Cesium.js:20055 XHR finished loading: GET "url_to_KML".loadWithXhr.load @ Cesium.js:20055(anonymous function) @ Cesium.js:19951(anonymous function) @ Cesium.js:630when @ Cesium.js:493loadWithXhr @ Cesium.js:19948loadBlob @ Cesium.js:57277KmlDataSource.load @ Cesium.js:108807processNetworkLink @ Cesium.js:108506processDocument @ Cesium.js:108376processFeatureNode @ Cesium.js:108534(anonymous function) @ Cesium.js:108559(anonymous function) @ Cesium.js:630then @ Cesium.js:786all @ Cesium.js:941loadKml @ Cesium.js:108554(anonymous function) @ Cesium.js:108845(anonymous function) @ Cesium.js:630(anonymous function) @ Cesium.js:731processQueue @ Cesium.js:1081_resolve @ Cesium.js:767promiseResolve @ Cesium.js:793(anonymous function) @ Cesium.js:630(anonymous function) @ Cesium.js:732processQueue @ Cesium.js:1081_resolve @ Cesium.js:767promiseResolve @ Cesium.js:793(anonymous function) @ Cesium.js:525(anonymous function) @ Cesium.js:630(anonymous function) @ Cesium.js:731processQueue @ Cesium.js:1081_resolve @ Cesium.js:767promiseResolve @ Cesium.js:793(anonymous function) @ Cesium.js:107225...

many....and many times!!!!

But my globe doesnt show the info that im waiting for, or even shows an error to look for!!!

Does any one have this same situation??, how can I look what is going on, increase log level, set breakpoints??

I hope anyone can help me.

Thank you very much!!

; )

Hello,

It might be a CORS problem (http://en.wikipedia.org/wiki/Cross-origin_resource_sharing) if your kml resources are located outside of the server where Cesium is hosted and if CORS is not enable on these servers.

You can test if CORS is enable on a server with curl (replace http://theograble.github.io/kml.doc with your kml urls. For network links case, you need to indicate url in the href tags) :

  $ curl -Is http://theograble.github.io/kml.doc |grep Access-Control-Allow-Origin

If you see something like this :

  Access-Control-Allow-Origin: *

CORS is enable on this particular server.

Is this tree of NetworkLinks specifically for imagery? Or are you loading vector data in them as well? If it’s all imagery, what you have is what Google refers to as a SuperOverlay, which is there term for a heuristic based approach to tiled imagery in Google Earth. Unfortunately Cesium doesn’t support this yet but it’s on the roadmap Depending on the format of your imagery on the server, it might be trivial to load your imagery in Cesium, just not through a KML file.

If your data is not a SuperOverlay and is instead just a bunch of NetworkLinks, it may be a CORS issue as theOgrable suggested, but it’s hard to say without more information. Is this file using public data? Can you share it?

In addition to what Matt said about the SuperOverlays, one of the simplest methods to troubleshoot if you’re having a CORS problem or not is to start Chrome from the command line with the ‘–disable-web-security’ parameter passed to it. If your KML loads, then you know you need to modify the server that is hosting your KML to allow your domain to access its files.

http://peter.sh/experiments/chromium-command-line-switches/#disable-web-security

Hello all... and thank you very much for your answers!!!

I was working in the CORS possibility you comment, and with the infrastructure people get the desire Output ( Access-Control-Allow-Origin: * ) to the curl command.

That lets us know that we are not having a CORS problem.

As Matthew mention, it looks like we are using SUPER-OVERLAYS, it creates a huge tree of KML files, and each one loads an image with specific position info.

is there another way to take that KML info and loading into Cesium?? please let me know... as you mention ("...it might be trivial to load your imagery in Cesium, just not through a KML file.").

Thank you very much... its really nice feeling that you are not alone in the world.... jajajaja.... : )

PD: Changing subject, I want to contribute, so Im creating a Beginners Cesium Example, including a lot basic of functionality (FlyTo, Add Label, Add Billboard, Current location, etc), this examples could help so much other beginners in Cesium World, it will be nice to get into the Sandcastle, how can i do that??

Thank you again!!! ; )

We’re always looking for people to contribute. The first step to getting an example into Sandcastle is to create Gists in GitHub of your examples. Then share them in this forum.

Sandcastle is going to be undergoing a total revamp this summer. If you want to help with that you can go over to the thread and share some of your ideas.

Hello Matthew, please help me... you mention:
"...Depending on the format of your imagery on the server, it might be trivial to load your imagery in Cesium, just not through a KML file."

I was looking and my server structure is in levels, Folders, KML files and PNG files, with numeric names.

Each KML file has Network Links and its own PNG.

How can i Load the imagery in CESIUM not through a KML File???

Please Help me...

Thank You!!!!

Are the directories named numerically? i.e. Something like 3/1/0.png? You may be able to use TileMapServiceImageryProvider You might also be interested in the Imagery Tutorial. Do you know how the data was generated?

Once again thank you very much for your answer, indeed I was using TileMapServiceImageryProvider because as you say the folder structure es numerical Z/Y/X, Using this alternative I can load some Tiles, but the way the Existing tiles was generated, It doesn't load all the Tiles specially the poles tiles.

It was generated as SUPER LAYER for Google Earth. i dont know which tool was used for, anyway, im looking for the original Macro Files to recreate the Tiles images and load is using TileMapServiceImageryProvider.

Thank you very much!!!