Google Earth - Balloon at launch

百般思念 提交于 2019-12-11 07:16:20

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/19841029/google-earth-balloon-at-launch

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!