February 2nd, 2009 | Published in Google Open Source
As you may have heard, a new version of Google Earth was released today. As has been the case with many Google Earth releases, this new version required expansions to KML, Google Earth's most important supported file format. After all, developers want access to all the interesting new features that have been added to Google Earth's UI.
Only one problem: Google no longer controls KML. We submitted it to the Open Geospatial Consortium (OGC) last year, where it is now maintained as an official OGC standard. The solution: extension namespaces!
You see, the OGC specification for KML includes explicit hooks for vendors to create their own extensions to the language, using XML namespaces and XSD. This allows the creation of new elements that extend or add to existing ones. For example, Google's extension namespace is now declared at the top of KML files that are emitted by the new Google Earth 5.0, with an XML namespace declaration:
This tells parsers of that file to expect elements from that namespace in the file, prefixed by gx: (to distinguish them from the standard KML elements). So for example, the new touring feature in Google Earth can be expressed in KML with a <gx:Tour> element, in any KML file that includes the xmlns declaration above. Standards-compliant applications that don't understand the new namespace will simply ignore the new elements.
This allows us to comply with the standard specification for KML, without unduly restricting us from innovating and experimenting. Other vendors are also placed on similar grounds with respect to KML extensions, enabling a marketplace of innovation surrounding a core standard language.
But wait, there's more!
As previously announced on this blog, Google released and maintains a reference implementation for KML reading/writing: libkml. So it brings me great pleasure to point out that on the same day that the Google Earth team releases support for new KML extensions, we're also releasing libkml v0.9, which fully supports all of the new extension elements as well. This new version of libkml can be used to read and/or write all of the new KML elements, including those used for time slider control, the new altitudeMode for ocean data, and of course, the largest new feature in KML... Touring, which enables controlled camera and object animation.
So by all means, check out the new Google Earth, and check out the new libkml. Developers interested in the fine details of the new extension elements are advised to check out our section on that topic in the KML reference.