Tuesday, February 03, 2009

New KML extensions?

There appears to be a few new KML extensions with the new Google Earth 5.0 release. As someone who has to keep up with my own implementation of the KML standard, this is of great interest to me. The new extensions seem to mostly be geared toward creating animated tours, a laudable goal. I think that is a great improvement in providing the ability for everyone to create more eye candy using GE. For some reason they just added a new namespace "gx" rather than putting out a new version of the spec. I guess this makes sense since the core functionality didn't change much and they can roll the new elements into the main spec in a future version.

The <gx:TimeSpan> and <gx:TimeStamp> tags are what most interest me. The spec quotes that they are merely copies of their standard KML namesakes, but that they "allow for the inclusion of time values in AbstractViews" and "Time values are used to control historical imagery, sunlight, and visibility of time-stamped Features". I don't know why they had to add copies in a different namespace when they could have just allowed the non gx versions to be included in the <Camera> and <LookAt> tags. What I think this all means is that you can now control the timeline of visible features using the <Camera> tag. A huge improvement. however I've spent a year or two going down the road of trying to create dynamic animations using static control values to hardwired algorithms. It will get you down the road a little ways, but it is a totally inflexible and brittle way of defining 3D animation.

I am a little disappointed that they didn't include time coordinates as I suggested last summer. I think that I mentioned at the time that I had no interest in spending time getting that feature through the appropriate committees to make it happen, but I think that at this point I probably would, even though I have less time available now. The time coordinates I proposed, based on modified julian date, are tremendously useful.

As an example, the new EarthBrowser Site Tracker uses them to define the animated visitor hits. Basically each visitor hit looks like this:
<Placemark>
<name>...</name>
<LineString>
<coordinates>coord0 coord1 coord2 ...</coordinates>
<ebr:time>mjd0 mjd1 mjd2 ...</ebr:time>
<ebr:fade>.0625</ebr:fade>
</LineString>
</Placemark>


The interesting parts are the <ebr:time> and <ebr:fade> tags. What they specify are the modified julian date time value at which each coordinate in the LineString occurs. This provides an easy way to animate a single placemark by using linear interpolation to calculate intermediate locations for smooth animation and also provides the ability to show a cool time based fade effect. The <ebr:fade> specifies that after 1.5 hours the line trace should fade. I use these two KML extensions with the Satellite orbits in the latest version of EarthBrowser and also in the site tracker tool. To do something roughly equivalent in current KML, you would have to provide thousands of Placemarks each with their own TimeSpan and geometry, there would be no smooth animation or fade effect and it would take many megabytes for each placemark. With these two simple extensions I can display some really interesting features with effects in a single placemark with a very small footprint. If anyone from the OGC or Google is interested in contacting me about helping these extensions get through to the next spec, please post a comment or send me an email.

2 comments:

barryhunter said...

The reason for the extension, is KML is now controled by the OGC, so Google cant just add stuff to KML. Technically they could of put the additions up for consideration into the public standard, but that would either entail showing their hand before releasing the next version of Google Earth (very un Googley), or implementing and supporting the next version before it becomes (or is even submitted to) part of the real KML standard - with the risk that OGC could choose to change it.

Its possible/probably that these extensions will now be submitted to the OGC, and that the client can the either support 2.2+extension or 2.3 which has the entensions built in (without the gx prefix)

Anonymous said...

Interesting site when I noticed my coworker ran it on her Mac.
As an aviation buff, it would be nice to have flight tracker as a plugin to the software as an additional selling point.
Rob.