radio buttons in GE api

23 views
Skip to first unread message

Nora

unread,
Jun 25, 2009, 5:12:40 PM6/25/09
to KML Developer Support - Google Earth Plug-in
Hi all:

I've been trying to set the radio buttons for my GE api, in order to
show one KML at the time (in my site (\\192.168.6.3\mapforgen
\test_buttons.html), each Modelo # corresponds to a different KML
file). Currently, my map is not working in this way, if you select,
say Model 5, and then select Model 1, Model 5 won't disappear, and
both models will be shown.

Does any one knows how to deal with this, I think is something related
with JS, however I couldn't find out an answer.

Regards,


Nora Castañeda
Research assistant
Bioversity International


fraser (Earth API Guru)

unread,
Jun 25, 2009, 6:02:17 PM6/25/09
to KML Developer Support - Google Earth Plug-in
Hi,

It's impossible to say without knowing more.
Could you post a link to an example?

F.

Nora

unread,
Jun 26, 2009, 8:44:38 AM6/26/09
to KML Developer Support - Google Earth Plug-in
Hi Fraser,

I already add the link in the past message (probably you didn't notice
it 'cause it wasn't highlighted). However, here it is:


http://gisweb.ciat.cgiar.org/mapforgen/test_buttons.html


regards,


Nora Castañeda
Research assistant
Bioversity International

Jonathan_me

unread,
Jul 6, 2009, 8:29:37 AM7/6/09
to KML Developer Support - Google Earth Plug-in
Hi Nora,
Hopefully not too late. I've done something similar with checkboxes,
where the user can turn KML layers on and off. I'm using Network
links. The process is something like this:

I have a multi-dimensional array which contains all of my KML layers,
looking like this:

this_array =
['UNIQUE_ID1', ge.createNetworkLink("");, <KML LINK HERE>", "Human
text"], .....
['UNIQUE_ID2', ge.createNetworkLink("");, <KML LINK HERE>", "Human
text"];


For you as you're using a radio button, you'd want something like this
maybe:

function radioclick(UNIQUE_ID);

//turn off all layers - not the most efficient way, but it
should work. :-)
for(var i = 0; i < this_array.length; i++) {
removeNetworkLinks(this_array[i][1]);
}

//create the new layer as specified by the unique_ID
createNetworkLink(this_array[UNIQUE_ID][1], this_array
[UNIQUE_ID][2]);
}

Jonathan

shsavage

unread,
Jul 13, 2009, 12:40:53 PM7/13/09
to KML Developer Support - Google Earth Plug-in
Hi Nora,

In the example posted at http://gaialab.asu.edu/DAAHL/testmap.htm
there is a drop down list of empires. Each one is a kml file, and
using the onchange event, a function is triggered that unloads the
current kml file and loads the selected one. It uses network links.
Somethinglike this can be easily adapted to checkboxes.

-Steve
Reply all
Reply to author
Forward
0 new messages