dLegend

Richard Greenwood richard.greenwood at GMAIL.COM
Fri Jan 26 17:04:09 EST 2007


On 1/26/07, william paul <williampaul28 at yahoo.com> wrote:
> Hi Rich:
>
> Please excuse me for contact you on your email. I have seen in your new
> teton county mapserver that you can activate deactivate the layers
> automatically. How can I do this? and how I can load the page with some
> layers already checked
>
> Thank you again
>
> William

I am copying to the mapserver list so that others may contribute
and/or benefit from our discussion.

To eliminate the "redraw map" link, you define a legend handler like this:

function legendHandler(name, state) {
   ms.setLayer(name, state);
   ms.draw();
}

To set the initial state of layers, you call the changeNodeStatus()
function. In my window.onload() function I use the following code:

var slayers = ms.getLayers(",")
var alayers = slayers.split(",");
for(var i=0; i<alayers.length; i++)
    legend.changeNodeStatus(alayers[i], "on");

The teton county dBox site is not done, but one that is a little
further along is here:
www.sublettewyo.com/mapserver/sc.html

Rich

-- 
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com



More information about the mapserver-users mailing list