fetching KMLs with radio buttons

85 views
Skip to first unread message

Jackan

unread,
Jan 4, 2010, 10:01:31 AM1/4/10
to KML Developer Support - Google Earth Plug-in
Hi Everyone,

I am using the stardard method to fetch KMLs with interactive
checkboxes given in this example [http://code.google.com/apis/ajax/
playground/?exp=earth#fetch_kml_(interactive,_checkboxes)] and am
trying to make a couple of tweaks to the code but have had no luck so
far and was wandering if anyone could shed some light?

Firstly instead of using checkboxes to fetch the KMLs I want to use
radio buttons so that only one KML is displayed at any one time. This
means that each radio button will have to remove the previous KML
being displayed before fetching its own. Anyone know if this is
possible?

Secondly instead of just fetching and displaying the KMLs, when a
radio button is clicked I want to fly the user to the KML similar to
when you use setFlyToView(true); with a network link. Again ideas?

Thanks in advance,

Jack

Nymor

unread,
Jan 4, 2010, 9:33:55 PM1/4/10
to KML Developer Support - Google Earth Plug-in
Hi,

In that example a checkbox can be checked or unchecked - the checking
adds it and unchecking removes it. So all you need do is remove any
loaded KML when you click a radio button - as you've stated. The kmls
are in a global variable so they will always be available once loaded
so it just a matter of appending/removing as and when. Not much more
can really be said without seeing you code to try and point to where
it might not be working for you.

As for a flyto - each kml will need a LookAt within the Document tag
and this can be got at using (in the notation of that example)
myLookAt = currentKmlObject[file].getAbstractView();

and by then using
ge.getView().setAbstractView(myLookAt);
to fly to it. (You can use ge.getOptions().setFlyToSpeed() to change
to speed at which you go to it - refer to the API docs for more info
on that).

Hope that helps
Nymor

Jackan

unread,
Jan 5, 2010, 5:28:17 AM1/5/10
to KML Developer Support - Google Earth Plug-in
Hi Nymor,

Thanks a lot for the help.

My KML's all have a "LookAt" specified within the Document tag now but
could you point me to where I would need to place the "myLookAt =
currentKmlObject[file].getAbstractView(); " and "ge.getView
().setAbstractView(myLookAt); " in the example I mentioned to enable
the API to access it?

Thanks again,

Jack
Reply all
Reply to author
Forward
Message has been deleted
0 new messages