Wednesday, September 19, 2007

libkml: wtf?

So I saw mention that Google is soon to be releasing an open source library for the kml format.
Google will be releasing an open-source KML library in C++ that implements and tracks the standard as it progresses.

I can see two intended audiences for this library; kml content creators and content consumers. I just don't think it makes sense for either of them. For kml creators, why would you need to interface with a C++ library in order to create kml files. The answer is, you shouldn't need to. It's kind of like my post on Dreamweaver, if you know what you are doing it just gets in the way and if you don't know what you are doing it is way too complex. A C++ library seems like overkill to write out some xml text. I guess it could keep track of external and document-wide styles? Big deal.

If you are a kml consumer then it makes a little more sense to use a library in C++, but not much more. Using external libraries requires you to build a bridge between your code and the library concepts. So the libkml will be dictating what types of entities you support and how they are interrelated within your code. This is restrictive on how you would develop your internal classes by forcing you to make a class structure identical to the libkml structure or you could try to build a conceptual bridge between your internal structure and the libkml structure in order to be compatible. Once you have either one, why would you need an external library just to parse the XML entities.
By providing a reference library it allows developers to more easily keep up to date with KML without having to maintain their own library and track standards changes.

So developers won't have to support any changes in the standard if they are using libkml? I guess it sounds more like it's for the kml content producers.
I guess an alternate explanation is that they are trying hard to make it seem like the standard will be truly open. Of course I'll take a look at it when it comes out to see what it's all about, but the whole concept seems like an exercise in futility.

5 comments:

Anonymous said...

Because KML is more complex than you think it is.

Do you understand how shared and inline styles are merged? How <Region> really works? How <Update> functions? Do you know the caching behavior of the many different ways in which content can be fetched?

Furthermore, do you know how to hold several thousand features in memory and traverse their structure 60 times per second to query for what is visible at that instant? The 2D case, while not thousands of potentially active drawables, is still not trivial.

The goal could be to allow other implementations of KML (NASA World Wind, ESRI ArcGIS Explorer, etc.) to have an easier time of doing this. It turns out that KML 2.2 is actually pretty darned complex and subtle and hard to implement correctly.

matt_giger said...

You sound like you know something about it, and it sounds like it is for content consumers. Great!

I'd love to not have to worry about doing all of that in order to support KML in EarthBrowser. I agree that determining visibility for a large sets of data is exceedingly difficult to get right.

Not knowing anything about what the library supports beyond vague generalizations, I'll hold off judgement. I just hope that the library doesn't take it upon itself to create threads, access the network or other unpredictable behavior. I've been burned many times with those sorts of integration issues.

Please give details? What OS license will it be for one?

Mateusz Loskot said...

I'd like to see libkml available under Boost License. BL seems to be most reasonable license for an Open Source library. It's well thought.

Anonymous said...

Google is candidating KML as an ISO standard. As such, an opensource implementation is a almost a must.

darkblue_b said...

dude - your all backwards.. If KML is a standard, why not have a reference implementation to write it out.. If its reasonably well done, what's the downside? Modern sfwr is all libraries..

As for reading.. why do you want to write parsing stuff? The 0.1 libkml is not great for reading.. but its uh, 0.1.

This is made for you...

However, you are the clearly opinionated, go-it-alone individualist that is writing your own browser.. gotta like that.. on the whole, confusing