.NET Kml wrapper framework



My first “real” blogpost is going to be about a .NET wrapper framework for KML.

KML is the XML standard that Google Maps and Google Earth utilizes when loading marker points. By using KML these markers can be loaded asynchronously through the Google Maps AJAX API.

The .NET KML wrapper framework enables users (you) to create the KML file through typed objects. I’m not going to go into detail for each and every class, but instead highlight key functionalty. How you choose to utilize the wrapper framework is up to you. I prefer the use of Http Generic handlers (.ashx), but implementing it together with a user control (.ascx) or directly on an ASPX-page is doable. In my next posts I’ll post examples of how to utilize the wrapper framework using a Http Generic Handler and implement Google Maps through a server control. These posts will be more code sample heavy, this post serving as the base.

OK – let’s go!

The code


This is the most important class in the wrapper framework. Through this you can remove and add KML objects.

The class essentially consists of an XmlTextWriter and a StringWriter which parses the KmlDocument, KmlPlacemark and KmlStyle objects.


How to use it

To generate KML the method GenerateKml() must be called!

This will go through all the added KmlDocument, KmlPoint and KmlStyle objects and convert them into actual KML.

By then calling the overriden ToString() method of the KmlGenerator-object the KML string is returned.


If you use it

Just let me know. I’ll be happy.

Download it!

DBLOG.KmlWrapper.binaries.zip (4,07 kb)

DBLOG.KmlWrapper.sourcecode.zip (28,08 kb)



Here’s a great link that my colleague and friend Gustaf Lindqvist told me about: Display KML. With this you can try out the generated KML and see how it renders on a Google Map. Great stuff, G!

Recent Posts
  • Sabry

    The download links are broken for this page. Any chance, you could get the source code to me for this?

Contact Us

We're not around right now. But you can send us an email and we'll get back to you, asap.

Not readable? Change text. captcha txt

Start typing and press Enter to search