[mapserver-users] PHP/Mapscript - globally manipulating layer status?

Daniel Morissette morissette@dmsolutions.ca
Wed, 30 Oct 2002 09:46:19 -0500


The loop on all layers is the only way to switch the status of all
layers.  There is no other trick available at the moment.

Daniel


Antti.Roppola@brs.gov.au wrote:
> 
> Hello all,
> 
> When rendering a key, I want to consider map layers
> on a case-by-case basis so I can insert text between
> key elements.
> 
> However, before I can do this I need to set every layer
> in the map to "off" before I can switched them on individually:
> 
> for($n=0; $n<$num_layers; $n++) {
>         $layer=$map->getLayer($n);
>         $layer->set("status",0);
> }
> 
> Instead of all this looping, is it possible to globally switch
> the status of every layer? Say:
> 
>         $map->set("layer[]->status",0);
> 
> Or even better, apply the same operation to an arbitrary set:
> 
>         map->set("layer[$selected_layers]->status",1);
> 
> Cheers,
> 
> Antti