Thursday, June 2, 2011

libkml Marches On!

Monday, May 19, 2008at5:04:00 PM

Posted by Mano Marks, Geo APIs Team

Google has released version 0.2 of libkml, an open source library for serializing and deserializing KML files. libkml now uses a memory management scheme based on "smart pointers", and has deprecated the use of SCons. On Linux and Mac OS X it now use the traditional automake, and on Windows Microsoft Visual Studio. The "smart pointer" scheme presently restricts support for some alternate language bindings, so libkml 0.2 can only be called from C++, Java, and Python. Version 0.1 also supported PHP, Perl, and Ruby, and is still available in the subversion repository if you're interested. We plan on restoring the those bindings as soon as we can.

Check out the User Guide, and particularly the future development list.

Here's an example of what the code looks like:

// createkml.cc// This program uses the KmlFactory to create a Point Placemark and// prints the resultant KML on standard output.#include #include #include "kml/dom.h"// libkml types are in the kmldom namespaceusing kmldom::CoordinatesPtr;using kmldom::KmlPtr;using kmldom::KmlFactory;using kmldom::PlacemarkPtr;using kmldom::PointPtr;int main() { // Get the factory singleton to create KML elements. KmlFactory* factory = KmlFactory::GetFactory(); // Create . CoordinatesPtr coordinates = factory->CreateCoordinates(); // Create -122.0816695,37.42052549 coordinates->add_point2(-122.0816695,37.42052549); // Create and give it . PointPtr point = factory->CreatePoint(); point->set_coordinates(coordinates); // Create and give it a and the . PlacemarkPtr placemark = factory->CreatePlacemark(); placemark->set_name("Cool Statue"); placemark->set_geometry(point); // Create and give it . KmlPtr kml = factory->CreateKml(); kml->set_feature(placemark); // Serialize to XML std::string xml = kmldom::SerializePretty(kml); // Print to stdout std::cout

The engineers who worked on it put a lot of thought into making it fast and light weight. However, it is an alpha release. We really would love to have comments and feedback on it, both in the KML Developer Support forum and in the libkml issue tracker.

Permalink

Labels:KML,libkml

Newer PostOlder PostHome Site Feed
Add to Google

More Blogs from GoogleVisit our directory for more information about Google blogs.ArchivesArchivesMay (9)April (6)March (6)February (7)January (7)December (6)November (5)October (7)September (7)August (6)July (9)June (11)May (7)April (8)March (7)February (5)January (4)December (1)November (5)October (3)September (6)August (3)July (3)June (5)May (4)April (7)March (5)February (3)January (1)December (3)November (2)We Love Feedback

Discuss the Maps API in the official discussion group, or contact us if you have any questions about this blog.

LinksGoogle CodeGoogle Maps APIDocumentationDiscussion GroupWhat We're ReadingGoogle Maps ManiaGoogle SightseeingGoogle Earth BlogMore Google Dev Blog PostsRead more...
Google Maps API Blog is powered by Blogger. Start your own weblog.

Powered By Blogger Copyright © 2008 Google Inc. All rights reserved.
Privacy Policy | Terms of Service

No comments:

Post a Comment