Ultimate Sidebar

How to Write KML in VB.NET

104 13
    • 1). Launch the program that you use to program applications in VB.NET. Open the software project that you wish to modify and give it the ability to write KML files.

    • 2). Set the server MIME types as follows:

      application/vnd.google-earth.kml+xml kml

      application/vnd.google-earth.kmz kmz

    • 3). Enter the following code into your document to run the #ziplib library included with VB.NET and that will serve as the mechanism to write the KML file:

      using ICSharpCode.SharpZipLip.Zip;

      using ICSharpCode.SharpZipLip.Checksums;

    • 4). Insert the following code into the application and change "example.kml" to the actual name of the file that you wish to use:

      this.Response.Clear();

      this.Response.AppendHeader("Content-Disposition",

      "filename=\"example.kml\"");

      this.Response.ContentType = "application/kml";

      this.Response.AppendHeader("Content-Encoding", "kml");

      byte[] bytes = null;

      MemoryStream memStream = new MemoryStream();

      XmlTextWriter xmlTW = new XmlTextWriter(memStream,

      Encoding.UTF8);

      xmlTW.WriteStartDocument();

Source: ...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.