[mapserver-users] HTML Legend with PHP/Mapscript

Thomas Haechler thaechl at geo.unizh.ch
Fri Jun 28 00:17:15 PDT 2002


rob,

I also tried to use html legend functionality with php/mapscript, but I
was not able to set the template, since I missed some method in the
style of $map->legend->set("template", template.html);
I am curious how you actually did that.

I wanted to have the legend more dynamically anway, so I used the
createLegendIcon() method to draw the icon for each class seperately. I
took the example you can find in the mapserver directory:
mapserver-3.6.0/mapscript/php3/examples/test_draw_legend_icon.phtml
and modified it. now I have a loop which is going through all layers
mentioned in the mapfile and checking the status of the layer. a html
table is created with a row for each layer including a checkbox that is
checked if the layer status is on. if there are several classes in a
layer, seperate rows with the individual icons but without checkbox are
created for each of them. 

In that context, I also still have a unanswered question about
displaying legend icons for raster layers, which I recently posted:
http://mapserver.gis.umn.edu/wilma/mapserver-users/0206/msg00434.html

I hope that helped you, and maybe someone can give me a hint about my
question.

Thomy





-- 

THOMAS HAECHLER

Geographic Information Systems Division
Institute of Geography
University of Zurich
Switzerland

thomas.haechler at geo.unizh.ch



More information about the MapServer-users mailing list