[Chameleon] Layers always on
Paul Spencer
pspencer at dmsolutions.ca
Wed Nov 10 20:21:38 EST 2004
You will need to trick the code that controls layer visibility.
Basicallly, it sees the layer as off because the layer name does not
appear in the legendlayername array that is created when multiple
checkboxes are submitted using the name legendlayername[] (the [] tells
PHP to interpret multiple values as an array).
The only way I have found to do this (so far) is to use something like this:
[if name=visible oper=isnull]
<!-- layer visible if metadata visible not set -->
<input type="checkbox" name="legendlayername[]"
value="[leg_layer_name]"
[if name=layer_status oper=eq value=1]CHECKED[/if]
[if name=layer_status oper=eq value=2]CHECKED[/if]>
[/if]
[if name=visible oper=eq value=1]
<!-- layer visible if metadata visible set to 1 -->
<input type="checkbox" name="legendlayername[]"
value="[leg_layer_name]"
[if name=layer_status oper=eq value=1]CHECKED[/if]
[if name=layer_status oper=eq value=2]CHECKED[/if]>
[/if]
[if name=visible oper=isset]
<!-- layer NOT visible if metadata visible set to 0 -->
<input type="hidden" name="legendlayername[]" value="[leg_layer_name]">
[/if]
The important part is that you have metadata to indicate that the layer
should not be in the legend then you output a hidden input with the
right name and value.
Cheers,
Paul
Mark M wrote:
> Hi Ken,
>
> Thanks but no go. I'll explain more.
>
> I use the METADATA flag to remove the layer from the legend as you suggested. Then when I first view the map image, I see all the layers as expected and the legend as wanted. When I then zoom into the map, the legend is still OK However, I only see the layers
> that had been visible and checked on the previous legend. All layers unchecked and all layers hidden were not displayed. But, I want to have all the hidden layers to always display. Can this be done?
>
> Thanks,
> Mark
>
>
>
>
>
> ----- Original Message -----
> From: "Ken Sanderson" <ken at rockies.ca>
> To: "'Mark M'" <fosters4all at beer.com>, "'Chameleon List'" <chameleon at lists.maptools.org>
> Subject: RE: [Chameleon] Layers always on
> Date: Wed, 10 Nov 2004 11:43:02 -0700
>
>
>>I would put a metadata object on the layers you want hidden, then just
>>to a test on if that metadata object is set (isset) and if so don't
>>write them to the legend.
>>
>>Ken
>>
>>-----Original Message-----
>>From: chameleon-bounces at lists.maptools.org
>>[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Mark M
>>Sent: November 10, 2004 10:39 AM
>>To: Chameleon List; WIX Mailing List
>>Subject: [Chameleon] Layers always on
>>
>>
>>Hi,
>>
>>How do I keep a layer always showing on the map but never in the legend?
>>
>>I've used the process at
>>http://lists.maptools.org/pipermail/chameleon/2004-October/001526.html
>>to filter layers. This works for the first image but when I zoom in,
>>only layers that are checked are drawn (logically enough). So, layers
>>that are hidden from the legend are never seen again. Not good for me.
>>
>>I want users to be able to turn on and off some layers only. The other
>>layers are always on and are controlled by MINSCALE and MAXSCALE in the
>>map file. Anyone know how to do this?
>>
>>Mark
>>
>>
>>--
>>_______________________________________________
>>The coolest e-mail address on the web and it's FREE! Sign-up today for
>>Beer Mail @ beer.com.
>>
>>
>>_______________________________________________
>>Chameleon mailing list
>>Chameleon at lists.maptools.org
>>http://lists.maptools.org/mailman/listinfo/chameleon
>>
>>
>>
>
>
--
Cheers,
Paul
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Applications & Software Development |
|DM Solutions Group Inc http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+
More information about the Chameleon
mailing list