[Cartoweb-users] Simple legend dropdown?

Oliver Christen oliver.christen at camptocamp.com
Wed Jun 25 03:41:05 EDT 2008

possible yes,
easily no

you can relatively easily define some extra metadata for the layers which 
should not be displayed under the dropdown and then hack the layers.tpl by 
adding the corresponding metadata in {if..} clauses ( {if 
$element.layerMeta.special_meta_hidesp}...{else}...{/if} )
but there would still be a problem: the layer would need to be autoactivated 
when the select change and as far as I know this can only be done on php 
So you would need to extend ClientLayers (see 
and touch up the function fetchLayer (maybe, I havent investigated in 


> Is it possible to create a single, simple dropdown control for choosing 
> one of several layers (or layergroups); when chosen, that layer is 
> activated and the others in the dropdown list are de-activated.
> Another way of thinking about it is that I want the *behavior* of radio 
> buttons (mutually exclusive activation of one layer from a group) with the 
> *mechanism* of a drop-down list.
> The reason I want this is to save space - it's more compact than radio 
> buttons (in my case, I want to let the user choose one of 5 different 
> basemap or background layers, so that takes up 5 lines in the legend where 
> a drop-down list would take up 1). I'm targeting 1024 x 768 screen sizes 
> and 40% of the height is already taken up by the website's banner, menu, 
> and footer (not my design!), so I don't have much left to work with and I 
> want to minimize the need for scrolling as much as possible.
> The closest I can get is to create a layergroup with rendering = dropdown, 
> but this shows the selected layer (or layergroup) below the dropdown with 
> a checkbox. This has 2 disadvantages: (a) the layer I'm trying to display 
> appears twice in the legend - once as the selected value in the dropdown, 
> and once below in its own legend entry; (b) I still have to use that 
> layer's checkbox to activate/de-activate it.
> Any suggestions, examples? It doesn't seem like a crazy idea, but I 
> couldn't find anything to guide me in the documentation or this list.
> Thanks,
> Chris
> -- 
> Chris Duncan, Ph.D.
> President
> GISmatters
> duncan at GISmatters.com
> http://www.gismatters.com/
> 1 Tuckerman Ln
> Amherst, MA 01002
> Tel: 413-549-2052
> Fax: 508-637-2557
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users

More information about the Cartoweb-users mailing list