Google 地图是否尊重风格? KML 中的定义?
我正在使用 GGeoXml 对象将 KML 叠加在嵌入式 Google 地图上。 我需要自定义地标的弹出气球,因此我尝试使用
元素:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://earth.google.com/kml/2.0">
<name>Concessions</name>
<Style id="masterPolyStyle">
...
<BalloonStyle>
<text>
<![CDATA[
<h6>Concession</h6>
<h4>$[name]</h4>
<p>$[description]</p>
]]>
</text>
<displayMode>default</displayMode>
<bgColor>DDA39B81</bgColor>
</BalloonStyle>
</Style>
...
</Document>
这在 Google 地球中按预期工作,但嵌入式地图 API 似乎完全忽略了这一点。 我想我可以完全省略
元素,并将 HTML 中的所有内容放入
元素中,但我希望能够利用
元素以结构化方式显示自定义数据。
I'm using the GGeoXml object to overlay KML on an embedded Google Map. I need to customize the popup balloon for placemarks, so I'm trying to use the <BalloonStyle>
element:
<?xml version="1.0" encoding="utf-8"?>
<Document xmlns="http://earth.google.com/kml/2.0">
<name>Concessions</name>
<Style id="masterPolyStyle">
...
<BalloonStyle>
<text>
<![CDATA[
<h6>Concession</h6>
<h4>$[name]</h4>
<p>$[description]</p>
]]>
</text>
<displayMode>default</displayMode>
<bgColor>DDA39B81</bgColor>
</BalloonStyle>
</Style>
...
</Document>
This works as expected in Google Earth, but the embedded map API appears to ignore this altogether. I suppose I could just leave out the <name>
element altogether and just put everything in HTML inside the <description>
element, but I'd like to be able to take advantage of the <ExtendedData>
element to display custom data in a structured way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
现在记录在此处 (2009/04):
http://code.google .com/apis/kml/documentation/kmlelementsinmaps.html
(您什么时候问过这个问题?这个论坛/服务在每个问题上都需要一个很长的日期,其中包含年份:-))
2$c,
*梭子鱼
This is now documented here (2009/04):
http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html
(When did you ask this ? This forum/service needs a big fat DATE on each question, with a year in it :-) )
2$c,
*pike
不,就像你提到的,描述中的 html 是我知道你可以通过 kml/georss feed 控制气球样式的唯一方法。
No, like you have mentioned, html in the description is the only way I know that you can control the style of balloons through kml/georss feed.
实际上,上面引用的文档 (http://code.google.com/apis /kml/documentation/kmlelementsinmaps.html)一定已经改变了,b/c现在它说:
我的问题是似乎适用于一个 KML 文件,但不适用于另一个。 适用的一个有多边形地标,另一个有由图标表示的点 - 我想知道这是否就是原因......
Actually, the document referenced above (http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html) must have changed, b/c now it says:
My problem is that the <text> seems to work for one KML file, but not another. The one that works for has polygon placemarkers, the other has points represented by icons - I wonder if that is why...