[Mapserver-users] legend question
Map Surfers
map_surfer at yahoo.com
Wed Sep 10 15:20:29 PDT 2003
Thanks to all who posted back.
I decided to go with the following code:
[leg_group_html]
<tr>
<td align="left" valign="top" colspan="2"
bgcolor="#FFFFFF" nowrap>
<font face="Verdana, Arial, Helvetica" size="-1"
color="#000000">
<input type="checkbox" name="layer_status[]"
value="[leg_group_name]" [if
name=layer_status oper=eq value=1]CHECKED[/if] [if
name=layer_status oper=eq value=2]CHECKED[/if]>
<b>[leg_group_name]</b>
</font>
</td>
</tr>
[/leg_group_html]
[leg_layer_html order_metadata=WMS_ORDER opt_flag=15]
[/leg_layer_html]
[leg_class_html order_metadata=WMS_ORDER opt_flag=15]
<tr>
<td width="6" bgcolor="#FFFFFF"> </td>
<td align="left" valign="top" bgcolor="#FFFFFF"
nowrap>
<font face="Verdana, Arial, Helvetica" size="-1">
<img src="[leg_icon width=18 height=12]"
width="18" height="12" border="0"
align="left"> [leg_class_name]
</font>
</td>
</tr>
[/leg_class_html]
- thanks again -
--- Charlton Purvis <cpurvis at asg.sc.edu> wrote:
> Hi, Damian:
>
> That's not as easy to do, but I do it frequently.
> But let me make sure
> I understand what you want to do:
>
> [x] Group1Name
> Class1
> Class2
> Class3
> [x] Group2Name
>
> Is that right?
>
> If so, I do it by sneaking in a few METADATA
> variables inside my LAYER
> and also making the legend use fixed images (i.e.
> don't allow MapServer
> to use the ones it creates on-the-fly). To go into
> all the gory detail
> would be, well, gory. So I'll just throw some code
> at you and give you
> a few points.
>
> .map
> # I want to show
> # [x] speed bari absolute diff power2
> # color_block class 1
> # color_block class 2
> # etc.
> LAYER
> NAME "speed_bari_absolute_diff"
> GROUP "speed_bari_absolute_diff"
> STATUS OFF
> DATA "the_geom from domain_intersect"
> TYPE POINT
> CONNECTIONTYPE POSTGIS
> CONNECTION "user=postgres dbname=myGISdb
> host=localhost"
> SYMBOLSCALE 10000000
> TOLERANCE 4000
> TOLERANCEUNITS meters
> TEMPLATE "ttt"
> METADATA
> no_icon "ttt"
> list_icons "ttt"
> query_cols "xi yi unc_speed_bari um_speed_bari
> usf_speed_bari
> speed_bari_dif_abs speed_bari_dif_per"
> END
>
> Now look at the attached .html file. It's ugly!
> And the resulting html
> (after it is parsed) is even worse! I'm going to
> have to think of
> something slicker before I use it real-time. As a
> matter of fact, I
> don't think I'll use this solution, at all.
>
> But until then . . .
>
> * Usual checkbox if/then stuff, but I look for a
> metadata variable,
> no_icon, to see if it is set. If it is, then I
> don't want this group to
> have an icon at the group checkbox level. Just the
> checkbox, please.
> (use_icon means I do want a group-level icon.
> Follow the use_icon isset
> stuff to see that the image URL is placed at this
> point. All the
> javascript junk is to remove the underscores.
> * Write the group name. Same javascript underscore
> junk.
> * Now in the class level, I have hard coded checks
> for layer names. So
> if we're looking at the speed_bari_percent_diff
> layer, show the class
> icons which are hard coded the same way as the group
> icons in the first
> bullet.
>
> I realize that I'm just throwing stuff at you, and
> that's not completely
> helpful. If you want more details, say the word.
>
> Charlton
>
> > -----Original Message-----
> > From: Map Surfers [mailto:map_surfer at yahoo.com]
> > Sent: Tuesday, September 09, 2003 3:32 PM
> > To: mapserver-users at lists.gis.umn.edu
> > Subject: [Mapserver-users] legend question
> >
> > How would I make it so that the classes only
> displayed
> > if a user selected the layer/group to display?
> >
> > [leg_group_html]
> > <tr>
> > <td colspan="2" bgcolor="#CCCCCC"><font
> > face="Verdana, Arial, Helvetica" size="-1">
> > <input type="checkbox" name="layer_status[]"
> > value="[layer_group_name]" [if name=layer_status
> > oper=eq value=1]CHECKED[/if][if name=layer_status
> > oper=eq value=2]CHECKED[/if]>
> > <b>[leg_group_name]</b>
> > </font></td>
> > </tr>
> > [/leg_group_html]
> >
> > [leg_class_html]
> > <tr>
> > <td align="center" valign="top"><font
> face="Verdana,
> > Arial, Helvetica" size="-1">
> > <img src="[leg_icon width=18 height=10]"
> > width="20" height="10">
> > </font></td>
> > <td><font face="Verdana, Arial, Helvetica"
> > size="-1">
> > [leg_class_name]
> > </font></td>
> > </tr>
> > [/leg_class_html]
> >
> > TIA,
> >
> > Damian
> > [leg_group_html Opt_Flag=15]
> <tr bgcolor="#FFFFFF">
> <td align="center"><input type="checkbox"
> name="layer_status[]" value="[leg_group_name]" [if
> name=layer_status oper=eq value=1]CHECKED[/if][if
> name=layer_status oper=eq value=2]CHECKED[/if]></td>
> <td>[if name=no_icon oper=isnull] [if
> name=use_icon oper=isnull] <img src=[leg_icon]>[/if]
> [/if]
> [if name=use_icon oper=isset]
> <script>document.write('<img
> src=/legend_icons/seacoos_bathy/' +
> "[leg_group_name]".replace(/ /g,'_') +
> '.png>');</script>
> [/if]
> <font face="Arial, Helvetica, sans-serif"
>
size="2"><script>document.write("[leg_group_name]".replace(/_/g,'
> '));</script>[if name=list_icon
> oper=isset]...[/if]</td></font>
> </tr>
> [/leg_group_html]
> [leg_class_html opt_flag=15]
> [if name=layer_status value=1]
> [if name=layer_group oper=eq
> value=speed_bari_percent_diff]
> <tr><td><td><script>document.write('<img
>
src=/legend_icons/seacoos_bathy/speed_bari_percent_diff/'
> + "[leg_class_name]".replace(/ /g,'_') +
> '.png>');</script> <font face="Arial, Helvetica,
> sans-serif"
> size="2">[leg_class_name]</font></td></td></tr>
> [/if]
> [/if]
> [/leg_class_html]
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
More information about the MapServer-users
mailing list