Google Earth - Balloon at launch - kml

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.

Related

IconStyle hotspot not working as expected in tilt mode on Google Earth desktop

While creating a kml file, I'm encountering this annoying problem:
A placemark with icon hotspot set to the center is being placed just above the track path, instead of centered on it, when the view is being tilted.
This happens in Google Earth desktop for Windows [7.1.5.1557], while it is working correctly in Earth for Android, see here:
Screenshot Google Earth desktop Win (wrong hotspot when view is tilted):
Screenshot Google Earth Android (correct hotspot when view is tilted):
The iconStyle is defined as follows:
<IconStyle>
<Icon><href>wp_icon.png</href></Icon>
<scale>0.7</scale>
<hotSpot x="0.5" y="0.5" xunits="fraction " yunits="fraction" />
</IconStyle>
When I add the following, I can make it work like it should in Earth desktop, but then in Earth Android the icons are misplaced even more:
<heading>180</heading>
<gx:headingMode>screenUp</gx:headingMode>
I tried different combinations with heading values and
<gx:headingMode>screenUp</gx:headingMode>
<gx:headingMode>northUp</gx:headingMode>
<gx:headingMode>worldNorth</gx:headingMode>
but with no success to get the icons being displayed correctly in both versions of Earth (Win/Android).
Since I do not know a place to post bugs (https://code.google.com/p/earth-issues/ has been closed), I hope somebody from the Earth team will look into this, if nobody else comes up with a solution! Thank you.
The hotspot is correctly implemented with top-down view in mind, but there are a number of rendering bugs when you start tilting. As the tilt towards the horizon the icon starts to appear over above the point where it is placed, which is the behavior you are seeing. This particular bug was reported in the private google earth beta forum. The icon size also becomes smaller until they nearly completely appear at a 90 degree angle.
The Android app is newer than the Windows desktop app so apparently it compensates for the tilt when drawing the icons. It's a bug in the desktop client so any attempt to fix it in the desktop will most likely break it in the Android client as you've seen.
Surprised <gx:headingMode> does anything since that is not a documented Google Earth extension. This also does not appear in the most current XML schema. Careful about using undocumented extensions which may or may not work on a given client.
With earth-issues closed you can post problems to the Google Earth forum. For bugs you will be advised to submit feedback via the Help menu in Google Earth for the GE team to get them.

Openlayers 3 does not display icons in FireFox or Chrome

I have a problem displaying icons on an OpenLayers map when viewing the map in FireFox and Chrome. To isolate this behavior I created an Openlayers 3 script that displays icons on a map by loading data from a KML file. The script I'm using is based upon this Openlayers example:
http://openlayers.org/en/v3.4.0/examples/kml.html
Modifications to this script include reference my KML source file and the type of map to display.
Icons display properly when the kml icon reference url points to Google like:
<Icon>
<href>http://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_red.png</href>
</Icon>
But when I change the icon reference to the same icon located on my server, the icon is not visible in Chrome or FireFox.
<Icon>
<href>http://www.photoradius.com/data/assets/icons/mm_20_brown.png</href>
</Icon>
In all of my test cases, the icons display as expected in IE.
For reference, here are example files:
1) Icons display as expected in all browsers:
http://photoradius.com/debugol3/kml_google.htm
icon reference in kml file:
http://maps.gstatic.com/mapfiles/ridefinder-images/mm_20_red.png
2) Icons do NOT display in Chrome or FireFox (but do in IE)
http://photoradius.com/debugol3/kml_local.htm
icon reference in kml file:
http://www.photoradius.com/debugol3/icons/mm_20_brown.png
So the only difference in the two examples I've created is the location of the icon. If the icon is located on the Google server, it is plotted in all browsers. If it resides on my server, only IE plots the icons.
Any advice will be welcome.
Regards.

"Driving directions:" in kml balloons, suppressing - Kml doc file does not say

My project involves kml files that show several sites so I have several placemarks. The first placemark, well off to one side, shows a balloon with descriptive text that is forced to load on start-up, subsequent placemarks in the file identify specific features. I have read the documentation file: https://developers.google.com/kml/documentation/kmlreference#balloonstyle but I guess I don't understand it.
The doc file says: "To prevent the driving directions links from appearing in a balloon, include the element with some content, or with $[description] to substitute the basic Feature ." Alas, including the text element in BalloonStyle does nothing. If description is not included or is in BalloonSdozentyle, the icon cannot be selected (the cursor remains the hand). If description is there, so is "Directions:" in the balloon.
My kml file
http://www.pinacate.org/kmlfiles/hydrovolcanic.kml
shows a dozen icons. The intro balloon is forced to display by gx:balloonVisibility and shows without "Directions:" but when closed and then reopened using the "Hydrovolcanic" icon on the left, it has directions. Sykes Maar and Cerro Colorado maar cannot be selected. All the selectable icons show "Directions:" in the balloon. I cannot figure out how to turn it off.
Problem solved:
I hope I'm a better geologist than I am a coder. By trial and error, I finally found that "Directions:" is suppressed by putting the following code in the STYLE definition and not in the placemarks. In retrospect, it makes sense.
I wrapped $[description] in "text" tags and that in "BalloonStyle tags, all inside the "style" tag e.g.
<Style id="blahblah">
...
<BalloonStyle>
<text>$[description]</text>
</BalloonStyle>
...
</Style>
See https://developers.google.com/kml/documentation/kmlreference?csw=1#balloonstyle for more information.

Is there anyway to close balloons from placemarks read from kml if this kml was removed while balloon is still showed?

To put it simple, I have some placemarks in KML file, if I load this KML, then click on Placemark - balloon will show.
If i remove that KML, placemark is gone, but balloon still showed.
Anyway to make it close?
This should do the trick to close any open balloon:
ge.setBalloon(null);

How to: place link to another kml file within a placemark

I'm drawing the path of a ship sailing around the world, using a series of kml files, each containing multiple placemarks.
When I click on the last visible placemark, I DO NOT want to open a ballon containing text and a URL to the next file. Instead, I'd like GE to load and "flyto" the kml file that contains the next series of placemarks. So far, I haven't found a way to do this, so I'm wondering if it's possible. If so, how to? Thanks, John
I'm assuming you're using KML in Google Earth. KML doesn't have an "onclick" method for Placemarks like this, when you click on a placemark, it opens up a balloon if there is one to be opened. If you want something more guided, you can do a tour or you can open up a balloon that has a link with a ;flyto method added that takes you to a particular Placemark.

Resources