[OpenLayers-Users] What's the Best Way to Create Lengends with OL/MapServer?

Bill Thoen bthoen at gisnet.com
Sat Aug 15 07:59:47 EDT 2009


Greetings All,

What's the best way to create legends in an OpenLayers interface over 
MapServer? Is there a way to use the MS HTML legends from a mapfile, or 
do I have to start with GetLegendGraphic calls anyway? What I'd like is 
a Legend / Layer Control from which I could show / hide layers and see 
their current styles -- something like the type 3 legends described in 
the MS docs here: 
http://www.mapserver.org/output/html_legend.html#sample-site-using-the-html-legend. 
But these templates seem to be usable only with MapServer; OpenLayers 
doesn't appear to read a mapfile to that level.

In the long run, however, what I really want is a Layer Control; one 
that allows the user to change layer order, turn layers on and off, 
change their styles, mark a layer as selectable and/or  editable,and 
group layers so that the groups can be moved up or down, made visible or 
hidden, etc. as a group. That, I suppose, is a job for JavaScript or 
something similar, which I can do if that's the best approach, but if 
there's something ready to use out there already, I'd rather not 
re-invent it.

There always seems to be so many choices when you build your own that 
sometimes I hardly know where to start!


Thanks,
- Bill Thoen



More information about the Users mailing list