【发布时间】:2015-11-26 09:30:46
【问题描述】:
我正在使用从 Google Code Project 下载的最新版本的 geoxml3。我可以在我的地图上看到 KML 文件地标。问题是我也想显示标签。在我的 KML 文件中,我分配了 Style id 和 StyleMap id。
我在这个网站上搜索了gemoxml3 label,并被指向这篇帖子label a kml file in Google Maps API v3。问题是代码项目的 wiki 指向 Google Markers,它也没有提到如何显示标签。
我还搜索了 geocodezip 网站,但也没有找到任何内容。任何方向将不胜感激。
* 添加了 KML 格式 *
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>KML Test</name>
<StyleMap id="Tester-ICON">
<Pair>
<key>normal</key>
<styleUrl>#Tester-TEMPLATE</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#Tester-TEMPLATE</styleUrl>
</Pair>
</StyleMap>
<Style id="Tester-TEMPLATE">
<IconStyle>
<scale>2</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/paddle/ylw-stars.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<color>ff0000ff</color>
<scale>2</scale>
</LabelStyle>
<BalloonStyle>
<text><![CDATA[
$[description]
]]>
</text>
</BalloonStyle>
</Style>
<Placemark id="Event 1">
<name>Event 1</name>
<Snippet maxLines="0"></Snippet>
<description>
<![CDATA[
<style type="text/css">
.TDcell {
color: Black;
text-align: left;
}
.THeader {
color: Black;
font-weight: bold;
white-space: nowrap;
text-align: left;
vertical-align: text-top;
}
</style>
<p><b>Event ID:<b> 1</p>
<p><b>Type of Event:<b> Formal Dinner</p>
<hr>
<table cellspacing="1" cellpadding="3" width="500">
<tr>
<td class="THeader">Who:</td>
<td class="TDcell">POTUS</td>
</tr><tr>
<td class="THeader">What:</td>
<td class="TDcell">State of the Union Address</td>
</tr><tr>
<td class="THeader">When:</td>
<td class="TDcell">Jan, 20th 2016</td>
</tr><tr>
<td class="THeader">Where:</td>
<td class="TDcell">United States Capitol</td>
</tr><tr>
<td class="THeader">Why:</td>
<td class="TDcell">Updates</td>
</tr>
</table>]]>
</description>
<styleUrl>#Tester-TEMPLATE</styleUrl>
<Point>
<coordinates>-77.009072,38.890131,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
【问题讨论】:
-
我也有这个问题。我已经使用 geoxml3 解析器加载了一个 KML 文件并查看了地标,但不确定如何添加从 KML 地标名称字段中提取数据的标签。现在 geoxml3 在 github 中,我确实设法在这里找到了 wiki 文档的端口:github.com/geocodezip/geoxml3/blob/wiki/ParserReference.md 但它充其量是稀疏的。感谢您的努力和支持@geocodezip!
-
看看下面的答案是否解决了你的问题。