KML Placemark/LineString support

Hi,

I created a small implementation that supports KML files with Placemark
elements that have a LineString in them. Please see the KML class file
here:
https://github.com/OpenAviationMap/oam-WebGL/blob/master/lib/OpenAviationMap/KML.js

of note are the contructor and KML.fromUrls(), which is a convenience
function to add KMLs to a Cesium Viewer by specifying URLs to the KML files.

a sample usage can be found here:
http://akos.maroy.hu/wp-content/uploads/2013/07/oam-WebGL/ - which is
an un-packged version of Cesium, so it takes a while to load. but it
shows the usage and functionality:
http://akos.maroy.hu/wp-content/uploads/2013/07/oam-WebGL/main.js

    var viewer = widget.cesiumWidget;

    KML.fromUrls(['../130730_0600-LHTL-EDDE-HADAW.kml',
                  '../130730_1100-EDDE-EHLE-HADAW.kml',
                  '../130805_1130-EHLE-EGKB-HADAW.kml',
                  '../130808_1200-EGKB-EGHQ-HADAW.kml',
                  '../130810_0900-EGHQ-LFOZ-HADAW.kml',
                  '../130810_1100-LFOZ-LSZH-HADAW.kml',
                  '../130812_1000-LSZH-LSZL-HADAW.kml',
                  '../130814_0800-LSZL-LJPZ-HADAW.kml',
                  '../130814_1130-LJPZ-LHTL-HADAW.kml'],
                  viewer
                );

I also created a drag-and-drop mixin that handles KML files:
https://github.com/OpenAviationMap/oam-WebGL/blob/master/lib/OpenAviationMap/viewerDragDropMixin.js

and actually the above sample does handle KML files dropped into it as
well - do give it a try! after the file is loaded, it will animate the
camera view to show the KML LineString just loaded.

I'd be glad to broaden the supported KML features. I wonder if anyone is
aware of a comprehensive set of KML test documents that would serve as a
comprehensive test harness for KML features?

I also started to work on gx:Tour support for KML, but I got stuck with
orienting the camera (see a previous question of mine on this regard).
as soon as I get that, I could finish a simple initial implementation of
gx:Tour.

I'd be glad to contribute the above eventually into Cesium itself. (as
you see, the KML script does not reference anything but Cesium)

Akos

Hi Ákos,

Some how I missed this post when you first wrote it.

KML support for Cesium is also currently being worked by one of our Google Summer of Code participants, André Nunes. You can see the implementation roadmap we have in placed on Github here: https://github.com/AnalyticalGraphicsInc/cesium/issues/873 and check out his branch on linked from there. There’s still a ton of stuff to do, but we’re hoping to have something ready for an initial pull request by the end of the September.

This implementation varies greatly from yours in that it is based on the DynamicScene layer of Cesium (which I hope to eventually rename to DataSource). Rather than creating primitives directly, we create a generic representation of the KML features in memory first, and then create primitives for them via our Visualizer system. The reason for this is two-fold. First it allows various data sources, KML/GeoJSON/CZML/etc… to use the same visualization code and architecture; and second, it allows for us to maintain the objects in memory so that users can interact with them similarly to how they can interact with the KML tree shown in Google Earth. The actual Data Source Browser GUI is being worked separately by Scott in the DataSourceBrowser branch. The entire effort is a ton of work, but in the long run we think it will provide the best overall architecture for generic data sources in Cesium/

KML is definitely something we want, and if you’re interested, we can definitely work together to make it happen. I just wanted to give you a heads up now so you avoid doing a bunch duplicate work in the mean time. You are obviously free to continue your KML.js work if you want as well, but I wouldn’t expect to bring that into Cesium master in it’s current form, though we could end up incorporating parts of it into the system I laid out above.

Thanks,

Matt