Google 地图是否尊重风格? KML 中的定义?

发布于 2024-07-07 08:39:19 字数 1265 浏览 7 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鼻尖触碰 2024-07-14 08:39:19

现在记录在此处 (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

  • < BalloonStyle > no

(When did you ask this ? This forum/service needs a big fat DATE on each question, with a year in it :-) )

2$c,
*pike

忆梦 2024-07-14 08:39:19

不,就像你提到的,描述中的 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.

还在原地等你 2024-07-14 08:39:19

实际上,上面引用的文档 (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:

<BalloonStyle> partially only <text>
is supported

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文