[mapserver-users] HTML Legends - How to Display Multiple Groups?

Bill Thoen bthoen at gisnet.com
Tue Feb 23 06:39:20 PST 2010


Still trying to wring knowledge from the documentation on HTML Legends 
but with this one I need some help.

I've got a mapfile that has a normal set of layers with no groups, and 
then I 'INCLUDE' two additional mapfile fragments which are grouped 
roads and grouped hydrology (rivers, lakes, various and diverse 
wetlands, etc.) When I use the following code in my html file, I see all 
the layers represented in the mapfile:

[leg_layer_html order_metadata=legend_order opt_flag=15]
   <input type="checkbox" name=layer value=[leg_layer_name]
         [if name=layer_status value=1]CHECKED[/if]>

   [if name=layer_type value=4]
      <img src=[leg_icon width=22 height=18]>
   [/if]
   [if name=layer_type oper=neq value=4]<img src=[leg_icon]>[/if]

   <a href="[leg_layer_name]">[metadata name=WMS_TITLE]</a><br />
[/leg_layer_html]
 
The titles are hypertext links but they go nowhere; I'm just blindly 
copying what's in the docs, but I think this is just an extra freebie 
example within an example, so ignore it for now. Anyway, this code works 
as expected.

The problem occurs when I put a group header in front of this, 
specifically this bit of code:

    [leg_group_html]
        [leg_group_name]<br />
    [/leg_group_html]

With this added in I'm getting ONLY the road legend (which is displayed 
on top); the hydrology and the other layers are nowhere to be seen (I 
also checked with firefox to see if they were even there, perhaps lying 
hidden, but of them I could find no sign.)

Does this group configuration only work one one group at a time? How do 
I see all groups and non-grouped items? Can I selectively show all group 
names but hide the details like a expandable tree control? In short, 
where are the solid barriers to using this method to provide an 
unlimited layer and legend control? Or have I already hit it's 
limitations? Help with any or all of these questions would be very welcome.

Or if someone could just point me to a /working/ example of a fully 
tricked out HTML legend, that would be ideal. The one listed in the 
documentation, 
http://www2.dmsolutions.ca/msapps/itasca_legend/demo_init.html, is 
unhelpfully still broken.

...and if it matters in this case, here's my mapserv version info:

$ /var/www/cgi-bin/mapserv -v
MapServer version 5.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE 
SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER 
SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=GEOS INPUT=EPPL7 
INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE

Thanks for your help,

-- 
- Bill Thoen 
  GISnet - www.gisnet.com
  303-786-9961




More information about the MapServer-users mailing list