• 大小: 1.93MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-29
  • 语言: C#
  • 标签: GIS  KML  

资源简介

KML解析库,直接加载KML,可以获取KML中各种空间特征信息。

资源截图

代码片段和文件信息

using System;
using SharpKml.Dom;
using SharpKml.Engine;

namespace Examples
{
    /// 
    /// Iterates over all the Features in a Kml file and displays an information balloon
    /// 

    public static class BalloonFeatures
    {
        private const string InputFile = “Sample.kml“;

        public static void Run()
        {
            KmlFile file = Program.OpenFile(“Enter a file to show the features of:“);

            if ((file != null) && (file.Root != null))
            {
                EntityMapper mapper = new EntityMapper(file);
                foreach (var element in file.Root.Flatten())
                {
                    Feature feature = element as Feature;
                    if (feature != null)
                    {
                        string name = feature.Name ?? “Unnamed feature“;
                        string balloon = mapper.CreateBalloonText(feature);

                        Console.WriteLine(“Feature balloon text for ‘{0}‘\n{1}\n“ name balloon);
                    }
                }
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-05-16 03:47  Examples\
     文件        1127  2013-05-16 03:47  Examples\BalloonFeatures.cs
     文件        1785  2013-05-16 03:47  Examples\Change.cs
     文件        1628  2013-05-16 03:47  Examples\Clone.cs
     文件        1565  2013-05-16 03:47  Examples\CreateIconstyle.cs
     文件        1412  2013-05-16 03:47  Examples\CreateKml.cs
     文件        1205  2013-05-16 03:47  Examples\CreateKmz.cs
     目录           0  2013-05-16 03:47  Examples\Data\
     文件        1174  2013-05-16 03:47  Examples\Data\camera_mode.png
     文件         919  2013-05-16 03:47  Examples\Data\doc.kml
     文件        5310  2013-05-16 03:47  Examples\Data\Sample.kml
     文件     1486893  2013-05-16 03:47  Examples\Data\zermatt.jpg
     文件        3452  2013-05-16 03:47  Examples\Examples.csproj
     文件         815  2013-05-16 03:47  Examples\Inlinestyles.cs
     文件         751  2013-05-16 03:47  Examples\ParseKml.cs
     文件        5711  2013-05-16 03:47  Examples\Program.cs
     文件        1464  2013-05-16 03:47  Examples\Showstyles.cs
     文件        2149  2013-05-16 03:47  Examples\SortPlacemarks.cs
     文件         803  2013-05-16 03:47  Examples\Splitstyles.cs
     文件        1422  2013-05-16 03:47  SharpKml-SL.sln
     文件        1872  2013-05-16 03:47  SharpKml.sln
     目录           0  2013-05-16 03:47  SharpKml\
     目录           0  2013-05-16 03:47  SharpKml\base\
     文件        2891  2013-05-16 03:47  SharpKml\base\Angle.cs
     文件        9338  2013-05-16 03:47  SharpKml\base\Color32.cs
     文件         769  2013-05-16 03:47  SharpKml\base\ElementEventArgs.cs
     文件        2486  2013-05-16 03:47  SharpKml\base\ElementWalker.cs
     文件         744  2013-05-16 03:47  SharpKml\base\KmlAttributeAttribute.cs
     文件        2129  2013-05-16 03:47  SharpKml\base\KmlElementAttribute.cs
     文件        5170  2013-05-16 03:47  SharpKml\base\KmlFactory.cs
     文件        4253  2013-05-16 03:47  SharpKml\base\KmlFormatter.cs
............此处省略289个文件信息

评论

共有 条评论