ASP.NET VB KML Generator

和自甴很熟 提交于 2019-12-04 16:49:15

This is an example, not a question. Hopefully it will help others looking to use VB.net and ASP.NET to create kml/kmz files.

I have another example strictly using SharpKml.

public void ProcessRequest(HttpContext context)
{

    context.Response.AppendHeader("Connection", "close");
    context.Response.ContentType = "application/vnd.google-earth.kmz";
    context.Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
    context.Response.AddHeader("Content-Disposition", "attachment; filename=mykmz.kmz");

    Point point = new Point();
    point.Coordinate = new Vector(-13.163959, -72.545992);

    Placemark placemark = new Placemark();
    placemark.Geometry = point;
    placemark.Name = "Machu Picchu";

    KmlFile kml = KmlFile.Create(placemark, false);

    KmzFile kmz = KmzFile.Create(kml);
    kmz.Save(context.Response.OutputStream);

}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!