.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!
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.