[mapserver-users] HTML Legend with Status Checking...

Martin, Daniel DMartin@erac.com
Tue, 1 Oct 2002 11:37:21 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------=_NextPartTM-000-2c47dd60-d557-11d6-bb09-00508bcfdcc7
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C26968.D0BF2BE0"

------_=_NextPart_001_01C26968.D0BF2BE0
Content-Type: text/plain;
	charset="iso-8859-1"

Try this.  Take out the leg_group_html section, and the leg_layer_html
section, leaving only the leg_class_html section.  Take them out entirely -
don't leave an empty set of tags.  Then, let me know what happens.
 
-Dan

-----Original Message-----
From: Mike Smith [mailto:nospam@cnrit.tamu.edu]
Sent: Tuesday, October 01, 2002 11:33 AM
To: Martin, Daniel
Cc: mapserver-users@lists.gis.umn.edu
Subject: Re: [mapserver-users] HTML Legend with Status Checking...


Gladly.  Here is my legend code:

[leg_group_html]
  <tr>
        <td colspan=3 bgcolor=#cccccc><b>[leg_group_name]</b></td>
  </tr>
[/leg_group_html]

[leg_layer_html]
[/leg_layer_html]

[leg_class_html]
  <tr>
        <td width=15>&nbsp;</td>
        <td>
          <img src="[leg_icon width=15 height=15]" width=15 height=15>
        </td>
        <td>
          [leg_class_name]
        </td>
  </tr>
[/leg_class_html]


However, it does not work as you say (and as the documentation on the web
page says!).  Layers that are "off" do not show up (that's as expected and
what I want), that's fine, but layers that are out of SCALE DO show up, and
that's not as expected and that's not as the documentation states and that's
NOT what I want.  For example, I have a layer called
Ethiopia_Rivers...here's what it looks like:

LAYER
  NAME "Ethiopia_Rivers"
  TYPE LINE
  STATUS off
  GROUP Ethiopia
  DATA "ethiopia_rivers"
  HEADER 'ethiopia_rivers.shp_header.html'
      CLASS
        MAXSCALE 8710165
        Name 'Ethiopia Rivers'
        COLOR 102 204 255
        TEMPLATE ethiopia_rivers.shp_query.html
     END  # CLASS
END  # LAYER

Now, when I'm viewing my map at full extent, my scale factor is 1: 20136789,
therefore if I click on the Ethiopia_Rivers layer at that zoom level,
nothing shows up in the map.  This is the exact behavior that I would
expect...I'm out of scale for that layer, so it doesn't show up in the map
until I zoom in.  The PROBLEM, however, is that the "Ethiopia Rivers" icon
and label pop up in my legend...this is counter-intuitive, contrary to the
documented behavior of Mapserver, and just flat-out frustrating!  If the
layer is not showing up in my map (because it's out of scale), then it
should NOT be in my legend either.  Grrrr!!!  Pardon me for sounding
bitter...I'm not lashing out at you, I'm very grateful for your help, I'm
just frustrated at Mapserver.

Thanks!

Martin, Daniel wrote:


Perhaps I misunderstood.  By default (no opt_flag set) layers that are out
of scale and layers that have a STATUS off will not show in an HTML legend.


A legend exactly like this should do exactly what it sounds like you want:

[leg_class_html]
<TR>
  <TD>
   <img src="[leg_icon]" border=0>
  </TD>
  <TD>	 
    <font face="arial" size=2>[leg_class_name]</font>
  </TD>
</TR>
[/leg_class_html]

I'm not sure why you are having trouble getting the default action.  Perhaps
you could provide your current legend.

-Dan

-----Original Message-----
From: Mike Smith [ mailto:nospam@cnrit.tamu.edu
<mailto:nospam@cnrit.tamu.edu> ]
Sent: Tuesday, October 01, 2002 10:59 AM
To: Martin, Daniel
Cc:  mapserver-users@lists.gis.u <mailto:mapserver-users@lists.gis.umn.edu> 

mn.edu
Subject: Re: [mapserver-users] HTML Legend with Status Checking...


Thank you, but this didn't change a thing.  Actually, let me correct 
that...it had a negative effect because now all my layers show up too, 
even if they are not displayed in the map.  I want only active layers to 
show in the legend and I want only IN-SCALE class symbols to show up in 
the legend, I don't want 4 symbols to show up in the legend for every 
layer that I have which has scale-specific classes...I just don't guess 
I can do that without converting everything over to Mapscript.  X-(

Any other ideas?

Martin, Daniel wrote:


You probably want a bit mask of 2 in your opt_flag.  Layers with STATUS off
still show, but layers out of scale don't show.  

[leg_layer_html opt_flag=2]


Per  http://mapserver.gis.umn.edu/doc36/html-legend-howto.html
<http://mapserver.gis.umn.edu/doc36/html-legend-howto.html>  :

1: If set, show layer even if out of scale (default: hide layers out of
scale). 

2: If set, show layer even if status is OFF (default: hide layers with
STATUS OFF). 

4: If set, show layer even if type is QUERY (default: hide layers of TYPE
QUERY) 

8: If set, show layer even if type is ANNOTATION (default: hide layers of
TYPE ANNOTATION) 


In my experience, opt_flag=2 is the most intuitive.

-Dan



-----Original Message-----
From: Mike Smith [ mailto:nospam@cnrit.tamu.edu
<mailto:nospam@cnrit.tamu.edu> ]
Sent: Mo

nday, September 30, 2002 5:06 PM
To:  mapserver-users@lists.gis.umn.edu
<mailto:mapserver-users@lists.gis.umn.edu> 
Subject: [mapserver-users] HTML Legend with Status Checking...


Hello,

   I've seen how you can make legends using PHP Mapscript that check to 
see whether a layer or class is in scale before displaying it in the 
legend, but no mention of how to do this if I'm not using Mapscript.  I 
have sub-classed many of my layers so that symbols show up in different 
sizes depending on how far zoomed in you are.  In other words, I'm using 
"MINSCALE" and "MAXSCALE" in my classes, but all of my classes show up 
in the legend and that's really annoying!  I want ONLY the in-scale 
symbol to show up in the legend as it does in the map...any tips on how 
to do this without Mapscript?  I see the "if" conditional statements in 
the HTML Legend How-to, but there's no status of "SCALE" to 

check with 
those statements... if I could put an if statement in my legend template 
that checked whether or not a class or layer was in scale, then I'd be 
in business...any way to do this?

Thanks!









------_=_NextPart_001_01C26968.D0BF2BE0
Content-Type: text/html;
	charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">


<META content="MSHTML 5.50.4613.1700" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=328113416-01102002><FONT face=Arial color=#0000ff size=2>Try 
this.&nbsp; Take out the leg_group_html section, and the leg_layer_html section, 
leaving only the leg_class_html section.&nbsp; Take them out entirely - don't 
leave an empty set of tags.&nbsp; Then, let me know what 
happens.</FONT></SPAN></DIV>
<DIV><SPAN class=328113416-01102002><FONT face=Arial color=#0000ff 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=328113416-01102002><FONT face=Arial color=#0000ff 
size=2>-Dan</FONT></SPAN></DIV>
<BLOCKQUOTE>
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> Mike Smith 
  [mailto:nospam@cnrit.tamu.edu]<BR><B>Sent:</B> Tuesday, October 01, 2002 11:33 
  AM<BR><B>To:</B> Martin, Daniel<BR><B>Cc:</B> 
  mapserver-users@lists.gis.umn.edu<BR><B>Subject:</B> Re: [mapserver-users] 
  HTML Legend with Status Checking...<BR><BR></FONT></DIV>Gladly. &nbsp;Here is 
  my legend code:<BR><BR>[leg_group_html]<BR>&nbsp; 
  &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td colspan=3 
  bgcolor=#cccccc&gt;&lt;b&gt;[leg_group_name]&lt;/b&gt;&lt;/td&gt;<BR>&nbsp; 
  &lt;/tr&gt;<BR>[/leg_group_html]<BR><BR>[leg_layer_html]<BR>[/leg_layer_html]<BR><BR>[leg_class_html]<BR>&nbsp; 
  &lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;td 
  width=15&gt;&amp;nbsp;&lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;img 
  src="[leg_icon width=15 height=15]" width=15 
  height=15&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &lt;/td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &lt;td&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  [leg_class_name]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  &lt;/td&gt;<BR>&nbsp; &lt;/tr&gt;<BR>[/leg_class_html]<BR><BR><BR>However, it 
  does not work as you say (and as the documentation on the web page says!). 
  &nbsp;Layers that are "off" do not show up (that's as expected and what I 
  want), that's fine, but layers that are out of SCALE DO show up, and that's 
  not as expected and that's not as the documentation states and that's NOT what 
  I want. &nbsp;For example, I have a layer called Ethiopia_Rivers...here's what 
  it looks like:<BR><BR>LAYER<BR>&nbsp; NAME "Ethiopia_Rivers"<BR>&nbsp; TYPE 
  LINE<BR>&nbsp; STATUS off<BR>&nbsp; GROUP Ethiopia<BR>&nbsp; DATA 
  "ethiopia_rivers"<BR>&nbsp; HEADER 
  'ethiopia_rivers.shp_header.html'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  CLASS<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MAXSCALE 
  8710165<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Name 'Ethiopia 
  Rivers'<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 102 204 
  255<BR>&nbsp; &nbsp; &nbsp; &nbsp; TEMPLATE 
  ethiopia_rivers.shp_query.html<BR>&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp; # 
  CLASS<BR>END&nbsp; # LAYER<BR><BR>Now, when I'm viewing my map at full extent, 
  my scale factor is 1:<FONT size=3><B> 20136789</B></FONT>, therefore if I 
  click on the Ethiopia_Rivers layer at that zoom level, nothing shows up in the 
  map. &nbsp;This is the exact behavior that I would expect...I'm out of scale 
  for that layer, so it doesn't show up in the map until I zoom in. &nbsp;The 
  PROBLEM, however, is that the "Ethiopia Rivers" icon and label pop up in my 
  legend...this is counter-intuitive, contrary to the documented behavior of 
  Mapserver, and just flat-out frustrating! &nbsp;If the layer is not showing up 
  in my map (because it's out of scale), then it should NOT be in my legend 
  either. &nbsp;Grrrr!!! &nbsp;Pardon me for sounding bitter...I'm not lashing 
  out at you, I'm very grateful for your help, I'm just frustrated at 
  Mapserver.<BR><BR>Thanks!<BR><BR>Martin, Daniel wrote:<BR>
  <BLOCKQUOTE 
  cite="mid:4ACBA1414DD9EE418CC250E4AAA9035A192B33@STL-EXBE-I03.corp.erac.com" 
  type="cite"><PRE wrap="">Perhaps I misunderstood.  By default (no opt_flag set) layers that are out<BR>of scale and layers that have a STATUS off will not show in an HTML legend.<BR><BR><BR>A legend exactly like this should do exactly what it sounds like you want:<BR><BR>[leg_class_html]<BR>&lt;TR&gt;<BR>  &lt;TD&gt;<BR>   &lt;img src="[leg_icon]" border=0&gt;<BR>  &lt;/TD&gt;<BR>  &lt;TD&gt;	 <BR>    &lt;font face="arial" size=2&gt;[leg_class_name]&lt;/font&gt;<BR>  &lt;/TD&gt;<BR>&lt;/TR&gt;<BR>[/leg_class_html]<BR><BR>I'm not sure why you are having trouble getting the default action.  Perhaps<BR>you could provide your current legend.<BR><BR>-Dan<BR><BR>-----Original Message-----<BR>From: Mike Smith [<A class=moz-txt-link-freetext href="mailto:nospam@cnrit.tamu.edu">mailto:nospam@cnrit.tamu.edu</A>]<BR>Sent: Tuesday, October 01, 2002 10:59 AM<BR>To: Martin, Daniel<BR>Cc: <A class=moz-txt-link-abbreviated href="mailto:mapserver-users@lists.gis.umn.edu">mapserver-users@list!
s.gis.u
mn.edu</A><BR>Subject: Re: [mapserver-users] HTML Legend with Status Checking...<BR><BR><BR>Thank you, but this didn't change a thing.  Actually, let me correct <BR>that...it had a negative effect because now all my layers show up too, <BR>even if they are not displayed in the map.  I want only active layers to <BR>show in the legend and I want only IN-SCALE class symbols to show up in <BR>the legend, I don't want 4 symbols to show up in the legend for every <BR>layer that I have which has scale-specific classes...I just don't guess <BR>I can do that without converting everything over to Mapscript.  X-(<BR><BR>Any other ideas?<BR><BR>Martin, Daniel wrote:<BR><BR></PRE>
    <BLOCKQUOTE type="cite"><PRE wrap="">You probably want a bit mask of 2 in your opt_flag.  Layers with STATUS off<BR>still show, but layers out of scale don't show.  <BR><BR>[leg_layer_html opt_flag=2]<BR><BR><BR>Per <A class=moz-txt-link-freetext href="http://mapserver.gis.umn.edu/doc36/html-legend-howto.html">http://mapserver.gis.umn.edu/doc36/html-legend-howto.html</A> :<BR><BR>1: If set, show layer even if out of scale (default: hide layers out of<BR>scale). <BR><BR>2: If set, show layer even if status is OFF (default: hide layers with<BR>STATUS OFF). <BR><BR>4: If set, show layer even if type is QUERY (default: hide layers of TYPE<BR>QUERY) <BR><BR>8: If set, show layer even if type is ANNOTATION (default: hide layers of<BR>TYPE ANNOTATION) <BR><BR><BR>In my experience, opt_flag=2 is the most intuitive.<BR><BR>-Dan<BR><BR><BR><BR>-----Original Message-----<BR>From: Mike Smith [<A class=moz-txt-link-freetext href="mailto:nospam@cnrit.tamu.edu">mailto:nospam@cnrit.tamu.e!
du</A>]<BR>Sent: Mo
nday, September 30, 2002 5:06 PM<BR>To: <A class=moz-txt-link-abbreviated href="mailto:mapserver-users@lists.gis.umn.edu">mapserver-users@lists.gis.umn.edu</A><BR>Subject: [mapserver-users] HTML Legend with Status Checking...<BR><BR><BR>Hello,<BR><BR>   I've seen how you can make legends using PHP Mapscript that check to <BR>see whether a layer or class is in scale before displaying it in the <BR>legend, but no mention of how to do this if I'm not using Mapscript.  I <BR>have sub-classed many of my layers so that symbols show up in different <BR>sizes depending on how far zoomed in you are.  In other words, I'm using <BR>"MINSCALE" and "MAXSCALE" in my classes, but all of my classes show up <BR>in the legend and that's really annoying!  I want ONLY the in-scale <BR>symbol to show up in the legend as it does in the map...any tips on how <BR>to do this without Mapscript?  I see the "if" conditional statements in <BR>the HTML Legend How-to, but there's no status of "SCALE" to 
check with <BR>those statements... if I could put an if statement in my legend template <BR>that checked whether or not a class or layer was in scale, then I'd be <BR>in business...any way to do this?<BR><BR>Thanks!<BR><BR><BR></PRE></BLOCKQUOTE><PRE wrap=""><!----><BR><BR><BR></PRE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C26968.D0BF2BE0--

------=_NextPartTM-000-2c47dd60-d557-11d6-bb09-00508bcfdcc7--