日期:2014-05-17  浏览次数:20479 次

c# asp.net 如何取下面的kml文件
如何用vs2008 c# asp.net 读下面的kml文件
只要<Placemark>的name 和longitude latitude.
<name>1</name>
<LookAt>
<longitude>128.8574432157351</longitude>
<latitude>35.80600083716327</latitude>

(如果是xml, 会遇到gx:altitudeMode 这个地方总是提示错误)

以下是kml 文件如下

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
<Document>
<name>mynew.kml</name>
<Style id="s_ylw-pushpin">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="s_ylw-pushpin0">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="s_ylw-pushpin_hl">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<Style id="s_ylw-pushpin_hl0">
<IconStyle>
<scale>1.3</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="20" y="2" xunits="pixels" yunits="pixels"/>
</IconStyle>
</Style>
<StyleMap id="m_ylw-pushpin">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin0</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl0</styleUrl>
</Pair>
</StyleMap>
<StyleMap id="m_ylw-pushpin0">
<Pair>
<key>normal</key>
<styleUrl>#s_ylw-pushpin</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#s_ylw-pushpin_hl</styleUrl>
</Pair>
</StyleMap>
<Folder>
<name>mynew</name>
<open>1</open>
<Placemark>
<name>1</name>
<LookAt>
<longitude>128.8574432157351</longitude>
<latitude>35.80600083716327</latitude>
<altitude>0</altitude>
<heading>10.55660223235264</heading>
<tilt>0</tilt>
<range>1540192.185251366</range>
<gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
</LookAt>
<styleUrl>#m_ylw-pushpin</styleUrl>
<Point>
<coordinates>121.8574432157351,35.80600083716327,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>2</name>
<LookAt>
<longitude>121.857443215735