HTML Legend.

Bart van den Eijnden (OSGIS) bartvde at OSGIS.NL
Sat Sep 23 03:45:08 EDT 2006


Hi Bob,

have a look here:

http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=648

It was added in 4.4.

Best regards,
Bart

Bob Basques schreef:
> All,
>
> Hi all, I've been using the HTML legend for a while now with very good 
> results, I have a check box system working nicely showing when a layer 
> is on/off, etc.
>
> I was wondering, has anyone an example of setting it up to grey out a 
> checkbox if the scale of view is out of range (MINSCALE/MAXSCALE in 
> the mapfile).  I have an idea of how it might be done, but not sure.  
> Just asking before I go at it from scratch.
>
> Here is my Legend TEMPLATE as it stands now along with a typical 
> MAPFILE entry, and a sample output on the end:
>
> MAPFILE ENTRY (one of many :c):
>
>     METADATA
>           LEGEND_TITLE "Census Tract Centroids"
>           LEGEND_META_GROUP "foreground"
>           LEGEND_DISPLAY_LEVEL "1"
>     END
>
>
> LEGEND TEMPLATE:
>
>     [leg_header_html]
>     [/leg_header_html]
>
>     [leg_group_html]
>     [if name=first_foreground_layer oper=isset] <b>Foreground:</b> <br
>     /> [/if]
>     [if name=first_background_layer oper=isset] <b>Background:</b> <br
>     /> [/if]
>
>     [if name=legend_display_level oper=isset]
>     [if name=legend_display_level oper=neq value=-1]
>     [if name=layer_status oper=neq value=2]
>     <input alt="[leg_group_name] Control"
>     [if name=legend_meta_group oper=eq value=foreground]
>     type="checkbox" [/if]
>     [if name=legend_meta_group oper=eq value=background] type="radio"
>     [/if]
>     name="layer" value="[leg_group_name]"
>     [if name=layer_status oper=neq value=0] checked="checked" [/if] />
>     [if name=group_maxscale oper=isset]
>     <input type="hidden" name="[leg_group_name]_Maxscale"
>     value="[metadata name=group_maxscale]" />
>     [/if]
>     [if name=group_minscale oper=isset]
>     <input type="hidden" name="[leg_group_name]_Minscale"
>     value="[metadata name=group_minscale]" />
>     [/if]
>     <img alt="[leg_group_name] Legend Image"
>     name="[leg_group_name]LegendImg" src="[leg_icon]" width="21"
>     height="14" />
>     [/if]
>     [if name=metadata_url oper=isset]
>     <a href='javascript:var temp = window.open("[metadata
>     name=METADATA_URL]", "meta",
>     "resizable,scrollbars,location,toolbar,height=300,width=500")'>
>     [/if]
>     [if name=legend_title oper=isset]
>     [metadata name=LEGEND_TITLE]
>     [/if]
>     [if name=metadata_url oper=isset]
>     </a>
>     [/if]
>     <br />
>     [/if]
>     [/if]
>     [/leg_group_html]
>
>
>     [leg_layer_html opt_flag=0]
>     [if name=legend_display_level oper=isset]
>     [if name=legend_display_level oper=eq value=2]
>     <img alt="Group Legend Image" src="[leg_icon]" width="21"
>     height="14" /><br /><span class="small">[leg_layer_name]</span><br />
>     [/if]
>     [/if]
>     [/leg_layer_html]
>
>
>     [leg_class_html opt_flag=0]
>     [if name=legend_display_level oper=isset]
>     [if name=legend_display_level oper=eq value=3]
>     <img alt="Class Legend Image" src="[leg_icon]" width="21"
>     height="14" /><br /><span class="small">[leg_class_name]</span><br />
>     [/if]
>     [/if]
>     [/leg_class_html]
>     [leg_footer_html]
>     [/leg_footer_html]
>
>
>
> OUTPUT:
>
>     <input alt="bg_mntrct00_point Control" 
>     type="checkbox" name="layer" value="bg_mntrct00_point" />
>
>     <img alt="bg_mntrct00_point Legend Image" name="bg_mntrct00_pointLegendImg" src="/tmp/view_27723_1158975512_22_0_20_12.png" width="21" height="14" />
>
>     Census Tract Centroids   
>       
>
>     <br />
>
>
>


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl



More information about the mapserver-users mailing list