本文介绍了Google地球-启动时的提示框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我打开KML文件时,我希望自动在弹出气球中显示图像/细节.通常,用户必须物理上单击文件夹/图像才能显示弹出窗口.

一旦KML启动,是否有任何代码可以让我显示提示框?

我知道如何添加屏幕叠加层,并在启动时将其显示在屏幕中间,但是除非您在侧边栏中将其选中,否则您无法将其从屏幕上移除.

谢谢!

解决方案

Google提供了一些对标准KML语言的扩展.这样的扩展之一就是该功能.在您的地标中添加值为1的元素<gx:balloonVisibility>将使说明气球在KML加载后立即显示.

请注意该元素的 gx:命名空间前缀,以及此示例所示的KML文件顶部的xmlns:gx声明.

示例:

<kml xmlns="http://www.opengis.net/kml/2.2"
 xmlns:gx="http://www.google.com/kml/ext/2.2">

  <Placemark>
    <name>Eiffel Tower</name>
    <description>
        Located in Paris, France.

        This description balloon opens
        when the Placemark is loaded.
    </description>
    <gx:balloonVisibility>1</gx:balloonVisibility>
    <Point>
      <coordinates>2.294785,48.858093,0</coordinates>
    </Point>
  </Placemark>

</kml>

参考:
https://developers.google.com/kml/documentation/kmlreference#gxballoonvisibility

错误:

此功能在旧版Google Earth中有效,但如果GE以此类KML启动,则该功能在Google Earth v7.1.2.2041中已被打破(至少在Windows上已确认​​),但它不会自动显示提示框,但如果GE已经开始,然后打开KML将自动弹出气球说明.错误报告已提交给Google.

When I open a KML file I would like to have an image/details display in a pop-up balloon automatically. Typically the user has to physically click the folder/image for the pop-up to appear.

Is there any code that would allow me to have the balloon appear once the KML is launched?

I know how to add an screen overlay and have that appear on the middle of the screen at launch, but you cannot remove it off the screen unless you check it off in the sidebar.

Thanks!

解决方案

Google provides a few extensions to the standard KML language. One such extension is that exact feature. Adding the element <gx:balloonVisibility> with a value of 1 to your Placemark will make the description balloon appear immediately when the KML is loaded.

Note the gx: namespace prefix to the element, which is is required as well as the xmlns:gx declaration at the top of the KML file as shown in this example.

Example:

<kml xmlns="http://www.opengis.net/kml/2.2"
 xmlns:gx="http://www.google.com/kml/ext/2.2">

  <Placemark>
    <name>Eiffel Tower</name>
    <description>
        Located in Paris, France.

        This description balloon opens
        when the Placemark is loaded.
    </description>
    <gx:balloonVisibility>1</gx:balloonVisibility>
    <Point>
      <coordinates>2.294785,48.858093,0</coordinates>
    </Point>
  </Placemark>

</kml>

Reference:
https://developers.google.com/kml/documentation/kmlreference#gxballoonvisibility

BUG:

This feature worked in older versions of Google Earth, but is broken in Google Earth v7.1.2.2041 (at least confirmed on Windows) if GE launches with such KML it won't auto display the balloon but if GE is already started then opening the KML will auto-popup the balloon description. A bug report has been filed with Google.

这篇关于Google地球-启动时的提示框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 13:24