(Google Earth) KML Validation Fuckup

Perm url with updates: http://xahlee.org/comp/kml_validation.html

(Google Earth) KML Validation Fuckup

Xah Lee, 2010-07-22

This article documents a condition of a software industry. It is a rant on software correctness and standards body responsibility.

So, today i'm working on kml files on my site again.

For example, a typical kml file on my site looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark>
<name>Aapua wind park</name>
<description>
Good for a visit.

Seven 80 meter high wind turbines.

See photos at:
 http://xahlee.org/Whirlwheel_dir/windturbine.html
</description>
<Point><coordinates>23.436459,66.827370</coordinates></Point>
<LookAt>
 <longitude>23.436459</longitude>
 <latitude>66.827370</latitude>
 <altitude>0</altitude>
 <range>10000</range>
 <tilt>0</tilt>
 <heading>0</heading>
</LookAt>
</Placemark>
</kml>

Usually i'm super careful about correctness, so when i started to add kml files on my website, i made sure that they are valid. I'm spend several hours reading Google Earth's kml tutorial, and reading Wikipedia on KML about it. I know, for a certainty, that the format i created to be used on my site are correct.

However, i don't remember that i've ever used a kml validator to verify whether my kml files pass. I think at the time (this is in 2006), there's no kml validators. In any case, so today i quickly found a authoritave kml validator at http://www.kmlvalidator.com/. And, boom, it says my files are invalid.

The first error is:

This does not appear to be an OGC KML document--expected document element in namespace "http://www.opengis.net/kml/2.2", but found: "http://earth.google.com/kml/2.2"

What the fuck?

The second error is:

cvc-complex-type.2.4.a: Invalid content was found starting with element 'tilt'. One of '{"http://www.opengis.net/kml/2.2":altitudeModeGroup, "http://www.opengis.net/kml/2.2":LookAtSimpleExtensionGroup, "http://www.opengis.net/kml/2.2":LookAtObjectExtensionGroup}' is expected.

I'm absolutely sure that i followed google tutorial carefully. So i went to google tutorial, again http://code.google.com/apis/kml/documentation/kml_tut.html. The phrase “http://earth.google.com/kml/2.2” is now nowhere to be found there. Apparantly, they changed it. Also, it no longer contain any "<tilt>" tag.

Apparantly, thru the years, as tech and software progressed, they made changes and fixed things, as usual. But the point here is, today a working programer has to know tens of protocols, formats, and multiple languages, and if the programer is super careful to follow spec, and later be fucked in the face for his efforts to follow spec, then why should listen to anything about correctness dealt out by standards bodies?

When XML and XHTML came alone in about 2000, we are told that XHTML will change society, or, at least, make the web correct and valid and far more easier to develop and flexible. Now it's a decade later. Sure the web has improved, but as far as html/xhtml and browser rendering goes, it's still a fuck soup with extreme complexities. It's hard to say if it is better at all than the HTML3 days with Font tags. The best pratical approach is still trial n error with browsers.

And, now HTML5 comes alone with a attitude, a flying fuck to the face about how XML is to replace html that was the mantra from standards bodies.


PS The story of my kml above is actually slightly simplified. When i started to create kml files in 2006, Google's tutorial says:

<kml xmlns="http://earth.google.com/kml/2.1">

But in around 2008, when i was working on kml again, i noticed that the version is not 2.1 anymore but 2.2, and i think the Google tutorial for a simple file start to contain the LookAt tag, like this:

 <LookAt>
 <longitude>23.436459</longitude>
 <latitude>66.827370</latitude>
 <altitude>0</altitude>
 <range>10000</range>
 <tilt>0</tilt>
 <heading>0</heading>
 </LookAt>

I don't remember if it became required tag or not, or if a kml 2.2 file without this blog will simply not have the old behavior in Google Earth. Or, perhaps this i got the idea of this block by looking at the many (thousands) existing kml files in Google Earth.

I spent a hour or two to add this block into my existing ~65 kml files and modified my elisp code that generate kml files. I wouldn't have done it if it wasn't important. Now, it all changes again, and this block is no longer shown in the simple example of Google Earth tutorial. Spent about 4 hours on this today, updating my site and research into this issue, not counting writing this article.

For many kml files, see: The Thousand-and-Second Tale of Scheherazade and Beautiful Architectures.

For emacs lisp code that generates kml files, see: Emacs Lisp: Writing a google-earth Function.

Popular posts from this blog

11 Years of Writing About Emacs

does md5 creates more randomness?

Google Code shutting down, future of ErgoEmacs