The world from the eyes of google……..

So to propagate the google love i am going to do a quick shot at at google earth and creating KML files to use with it.

Ok so google earth is a map/virtual earth type application , there are many out there but this is by far the most advanced one i have found that is free and easy to interact with programaticaly (i stand to be corrected). So at a closer inspection the google kml files are just xml documents that are formated to be read by google earth.

These files can be generated from GE but it means that you now have to manually create all the locations you want. What to do if like me you already have all the data stored and just want to import into GE. The simplest way for me is to google a quick app to do it for me , unfortunately there are no such .Net applications available.

So after a quick hacking session here is the result .

To work with the class do the following.

CodeTester.KMLGenerator gen = new CodeTester.KMLGenerator();
StreamWriter sr = new StreamWriter(“C:\\tset.kml”);
sr.Write(gen.generateKML());
sr.Flush();
sr.Close();

This will generate a kmlDoc and save it to file.The reason i went with returning a string is that i can then output the file directly to the users(on the web via ASP.Net). If anyone needs info on how to do this let me know and ill post the code.And it makes it just as easy to write it to file.
Please note there is still plenty of scope in the class for expansion (e.g. i read the data from a database to make my maps updateable via a web interface).

Please let me know what are your thoughts on this and if there are any major problems in design.
I could not upload the cs file so just download the file and rename to cs:)
Enjoy