[Chameleon] ungrouped layers and legendtemplate

Paul Spencer pspencer at dmsolutions.ca
Tue Jun 7 21:23:40 EDT 2005


it is possible that the code in the ParseURL loops though all the layers 
and turns off the first one of that name and then stops processing ... 
it would be relatively simple to change that ... remove the break; in 
that function.  However, I'm not sure I want to make that the default 
way of operating.

Cheers

Paul

Jacob Delfos wrote:
> Ken-ichi,
>  
> You must have a customised legend template, to prevent the labelled 
> layer from showing up. Because as long as one of the layers with that 
> name shows up, both will be visible in the map.
>  
> I noticed you have a metadata-entry called "legendvis". I'd rather call 
> it "LEGENDHIDE" (because "hiding" will be the exception). Now in your 
> legendtemplate, you must have something like:
>  
> [if name=LEGENDHIDE oper=isnull]
> <TR>
> .............
> </TR>
> [/if]
>  
>  
> This would make the item show in the legend, as long as the "LEGENDHIDE" 
> entry doesn't exist in the metadata of that layer.
> Let me know if you have any trouble.
>  
> regards,
>  
> Jacob
>  
>  
> -----Original Message-----
> From: Ken-ichi Ueda [mailto:kenichi.ueda at gmail.com]
> Sent: 8 June 2005 01:26
> To: Jacob Delfos
> Cc: chameleon at lists.maptools.org <mailto:chameleon at lists.maptools.org>
> Subject: Re: [Chameleon] ungrouped layers and legendtemplate
>  
> Hm, now that I look a little closer, I realize that when you have two
> layers with the same name, they turn on together but they don't seem
> to turn off together.  Have you ever experienced this?  Here's what my
> mapfile looks like:
>  
> LAYER
>         NAME "Highways"
>         GROUP "Default"
>         DATA "/path/to/highways"
>         STATUS ON
>         TYPE LINE
>         CLASSITEM "TYPE"
>         PROJECTION
>             "init=epsg:1000"
>         END
>         CLASS
>             NAME "Interstate"
>             EXPRESSION "INTER"
>             STYLE
>                 SYMBOL "circle"
>                 SIZE 2
>                 COLOR 255 51 51
>             END
>         END
>         CLASS
>             NAME "US Highway"
>             EXPRESSION 'US-HWY'
>             STYLE
>                 SYMBOL "circle"
>                 COLOR 102 102 102
>                 SIZE 1
>             END
>         END
>         CLASS
>             NAME "State Highway"
>             EXPRESSION 'ST-HWY'
>             MAXSCALE 1500000
>             STYLE
>                 SYMBOL "circle"
>                 COLOR 153 153 153
>                 SIZE 1
>             END
>         END
>     END
>  
> 
>     LAYER
>         NAME "Highways"
>         GROUP "hidden"
>         METADATA
>           "legendvis"  "hidden"
>         END
>         DATA "/path/to/highways"
>         STATUS OFF
>         TYPE ANNOTATION
>         LABELCACHE ON
>         CLASSITEM "TYPE"
>         LABELITEM "ROUTE1"
>         PROJECTION
>             "init=epsg:1000"
>         END
>         CLASS
>             NAME "Interstate"
>             KEYIMAGE "/path/to/interstate.png"
>             EXPRESSION "INTER"
>             STYLE
>                 SYMBOL "/path/to/interstate.png"
>                 COLOR 0 0 0
>             END
>             LABEL
>                 COLOR 255 255 255
>                 SIZE TINY
>                 MINFEATURESIZE 75
>                 MINDISTANCE 250
>                 POSITION cc
>             END
>         END
>         CLASS
>             NAME "State Highway"
>             KEYIMAGE "/path/to/statehwy.png"
>             EXPRESSION 'ST-HWY'
>             MAXSCALE 1500000
>             STYLE
>                 SYMBOL "/path/to/statehwy.png"
>                 COLOR 0 0 0
>             END
>             LABEL
>                 COLOR 0 0 0
>                 SIZE TINY
>                 MINFEATURESIZE 75
>                 MINDISTANCE 250
>                 POSITION cc
>             END
>         END
>         CLASS
>             NAME "US Highway"
>             KEYIMAGE "/path/to/ushwy.png"
>             EXPRESSION 'US-HWY'
>             STYLE
>                 SYMBOL "/path/to/ushwy.png"
>                 COLOR 0 0 0
>             END
>             LABEL
>                 COLOR 0 0 0
>                 SIZE TINY
>                 MINFEATURESIZE 75
>                 MINDISTANCE 250
>                 POSITION cc
>             END
>         END
>     END
>  
> Ideally I don't want the labelling layer to be visible in the legend,
> but I do want it to turn on and off with the data layer.  Any
> thoughts?
>  
> -Ken-ichi
>  
> On 6/1/05, Jacob Delfos <jacob.delfos at maunsell.com 
> <mailto:jacob.delfos at maunsell.com>> wrote:
>  > 
>  > Ken-Ichi,
>  >  
>  > You can adjust your legend template to look for a metadata-value that you
>  > made up, and then it can use boolean logic to determine whether or not to
>  > show the layer in the legend. Have a look at
>  > http://lists.maptools.org/pipermail/chameleon/2004-October/001526.html
>  >  
>  > In short: if a layer has the same name as another layer, they will 
> turn on
>  > and off at the same time, even if only one layer shows in the legend. 
> That
>  > way you can emulate groups, while also having control of individual 
> layers.
>  > In your case, I would add a layer to your mapfile, with "STATUS DEFAULT",
>  > and then use a metadata entry to prevent it from showing in the legend.
>  >  
>  > regards,
>  >  
>  > Jacob
>  >  
>  >  
>  > -----Original Message-----
>  > From: chameleon-bounces at lists.maptools.org 
> <mailto:chameleon-bounces at lists.maptools.org>
>  > [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of
>  > Ken-ichi
>  > Sent: 2 June 2005 06:03
>  > To: chameleon at lists.maptools.org <mailto:chameleon at lists.maptools.org>
>  > Subject: [Chameleon] ungrouped layers and legendtemplate
>  >  
>  > Hi all.  I feel like this is a problem I have solved in the past but I
>  > just can't seem to figure it out: my layers in a map file are organized
>  > into GROUPs, and I have an HTML legend template that works fine with the
>  > LegendTemplate widget.  However, when I have a layer that isn't a part
>  > of a group, it disappears whenever the map is updated (update, zoom,
>  > pan, whatever).  I was hoping to use ungrouping layers as a way of
>  > hiding them from the legend while still displaying them on the map.  Is
>  > Chameleon actually looking to some list of layers generated by
>  > LegendTemplate when it draws an updated map?  Is there a better way to
>  > effectively "hide" some layers from the legend in Chameleon?
>  >  
>  > Thanks in advance.
>  >  
>  > -Ken-ichi
>  > _______________________________________________
>  > Chameleon mailing list
>  > Chameleon at lists.maptools.org <mailto:Chameleon at lists.maptools.org>
>  > http://lists.maptools.org/mailman/listinfo/chameleon
>  > 
>  >  
>  >  
>  > JACOB DELFOS
>  > SPATIAL INFORMATION ANALYST
>  > Maunsell Australia Pty Ltd
>  > 629 Newcastle Street, WA 6007
>  > PO Box 81, WA 6902
>  > Leederville
>  > Western Australia
>  > ABN 20 093 846 925
>  >  
>  > Tel     + 61 8 9281 6185
>  > Fax    + 61 8 9281 6297
>  > jacob.delfos at maunsell.com <mailto:jacob.delfos at maunsell.com>
>  > _______________________________________________
>  > Chameleon mailing list
>  > Chameleon at lists.maptools.org <mailto:Chameleon at lists.maptools.org>
>  > http://lists.maptools.org/mailman/listinfo/chameleon
>  >
>  >
>  >
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the Chameleon mailing list