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

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.

Related

KML overlay splash screen

Is there a way to get an overlay of some kind to open in GE when the user loads my kml?
I want to add a splash screen with a disclaimer on it and i want to be sure each user sees it.
The overlay would appear as the kml is opened in GE and they would click to dismiss it.
Is this possible?
Try using CDATA for the description of the top-level object in your KML file (eg Doc or Folder). This will pop up as a balloon when user adds KML file to Google Earth.
If you're working with NetworkLinks, you could add the overlay when the NetworkLink first loads, then set refresh to occur a short time later (eg 5 seconds) which returns an Update with a to remove the Overlay.

Can Google Earth export kml files usable in the Google Earth Api?

Is it possible for me to go through and edit my virtual copy of the landscape being worked on and export that to kml, usable in the Google Earth API? In other words if I have my models, and color markings laid over the earth, can I share those certain addons through GE API (not allowing users to edit it).
Yes. There are a couple ways to do it.
In the left panel, right-click on the feature or features you want to capture in KML and select Copy. Then open your favorite editor and paste. You'll get the KML. You can save the KML to a file.
Another choice is to right-click on the feature and click "Save Place As...", which will let you save the file as a KML or KMZ.
Google hosts a tutorial.
Sure you can, but you will have to create an GE API instance.
We are coming up with a new product that will handle that.
Send me a note to jdelcid#3delcid.com if you are interested in knowing more about it and perhaps using it for your projects.
Best.
Jorge.

"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);

adding text to a kml icon

I have a document with many placemarks. Each placemark is a bicycle station, and I have to show how many bikes are in the station. Is there a way to add text to the placemark icon?
(I'm aware I can put this data in the balloon, but I really need to add this to the Icon)
Thanks,
Ami
I think the easiest way would be to change the icon file you are pointing to based on the number of bicycles at that location. You could use icons like these a MapIcons http://mapicons.nicolasmollet.com/numbers-letters/
The general answer is KML supports LabelStyle which allows you to style the displayed.
The other option is to create custom markers with the numbers associated with them.
Other options would depend on how you are displaying the kml.

Resources