I'm working on a website that when finished will allow the user to turn on and off a number of different KML layers using checkboxes, the layers are parsed through geoXML3 and I want to know how to control the order which the layers appear.
Currently if I have 2 polygon layers (layer A and B) and I click the checkbox to load layer A then I click the checkbox to load layer B layer B will be on top as it should be. However if I then uncheck both boxes, and select B first and then A, B is still drawn on top.
I assume this is because I parse the data only the first time the boxes are checked and afterwards I just show or hide them, but is there a way to manage which layer is on top?
Below is an example of the function I use to parse the layer and then turn it on or off.
function boundaryToggle_FOS() {
if (boundaryIsLoaded_FOS == 0)
{
boundaryIsLoaded_FOS = 1;
if (firstLoadFOS == 0)
{
kml_FOS.parse('FOS_Boundary_v03.kml');
firstLoadFOS = 1;
}
else
{
kml_FOS.showDocument();
}
}
else
{
kml_FOS.hideDocument();
boundaryIsLoaded_FOS = 0;
}}
No comments:
Post a Comment