OpenLayers和KML支持

OpenLayers和KML支持,openlayers,kml,Openlayers,Kml,我想知道OpenLayers(比如说v5.3.1)是否能够显示KML文件的气球样式信息(即文本、图像、附加的链接) 下面是一个非常简单的KML文件示例,如我想使用的文件: <?xml version="1.0" encoding="UTF-8"?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document> <Style id="style0"> <LineStyle

我想知道OpenLayers(比如说v5.3.1)是否能够显示KML文件的气球样式信息(即文本、图像、附加的链接)

下面是一个非常简单的KML文件示例,如我想使用的文件:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Document>
    <Style id="style0">
      <LineStyle>
        <color>ff000000</color>
        <width>1</width>
      </LineStyle>
      <BalloonStyle>
        <text>
            <![CDATA[
                <p>This is a fault<br /><br />
                <img style="height:100px;" src="http://www.ipgp.fr/~klinger/page_web/images/images_terrain/big_pushup_koko01.jpg"/></p>
            ]]>
        </text>
      </BalloonStyle>
    </Style>
    <Folder>
      <name>Calque 1</name>
      <Placemark>
        <styleUrl>#style0</styleUrl>
        <LineString>
          <coordinates>
            -61.6926474431735,16.2341653330369,0
            -61.6694171297468,16.2124434871456,0
            -61.673339087593,16.192531686805,0
            -61.6615730696896,16.1846876267478,0
            -61.6615730696896,16.1608538685609,0
            -61.6211463129778,16.1527082304885,0
            -61.6311019966009,16.1382269998943,0
          </coordinates>
        </LineString>
      </Placemark>
    </Folder>
  </Document>
</kml>

ff000000
1.
这是一个故障

]]> Calque 1 #样式0 -61.6926474431735,16.2341653330369,0 -61.6694171297468,16.2124434871456,0 -61.673339087593,16.192531686805,0 -61.6615730696896,16.1846876267478,0 -61.6615730696896,16.1608538685609,0 -61.6211463129778,16.1527082304885,0 -61.6311019966009,16.1382269998943,0

非常感谢你的帮助

OpenLayers可以处理KML,OpenLayers网站上的多个示例演示了这一点

接近您想要的,它将日期覆盖在OSM地图上,并在悬停功能时显示附加信息

要显示带有信息的气球气泡,可以使用
覆盖
。当然,还有一个例子:

只要将两者结合起来,就可以在弹出窗口中使用KML功能