[mapserver-users] HTML Legend with Status Checking...
Mike Smith
nospam@cnrit.tamu.edu
Tue, 01 Oct 2002 14:42:56 -0500
--------------040909080007010806040704
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
LAYER
NAME Parima_Surveyhouseholds
GROUP Region
TYPE Point
STATUS off
DATA parima_surveyhouseholds
HEADER 'parima_surveyhouseholds.shp_header.html'
TEMPLATE parima_surveyhouseholds.shp_query.html
CLASS
MINSCALE 20136780
Name 'Parima Survey Households'
SYMBOL 'triangle'
SIZE 5
COLOR 255 0 0
OUTLINECOLOR 0 0 0
END # CLASS
CLASS
MINSCALE 10068390
MAXSCALE 20136779
Name 'Parima Survey Households'
SYMBOL 'triangle'
SIZE 8
COLOR 255 0 0
OUTLINECOLOR 0 0 0
END # CLASS
CLASS
MINSCALE 5034193
MAXSCALE 10068389
Name 'Parima Survey Households'
SYMBOL 'triangle'
SIZE 11
COLOR 255 0 0
OUTLINECOLOR 0 0 0
END # CLASS
CLASS
MINSCALE 0
MAXSCALE 5034192
Name 'Parima Survey Households'
SYMBOL 'triangle'
SIZE 15
COLOR 255 0 0
OUTLINECOLOR 0 0 0
END # CLASS
END # LAYER
Martin, Daniel wrote:
> Could you provide the map file definition for the Parima Survey
> Households layer?
>
>
>
> Thanks,
>
> Dan
>
> -----Original Message-----
> From: Mike Smith [mailto:nospam@cnrit.tamu.edu]
> Sent: Tuesday, October 01, 2002 11:56 AM
> To: Martin, Daniel
> Cc: mapserver-users@lists.gis.umn.edu
> Subject: Re: [mapserver-users] HTML Legend with Status Checking...
>
> Same thing. Now I don't have group header bars seperating my
> layers, but all the layers still show up and when I click on a
> layer that has scale-specific classes, the symbols for all scales
> still show up. By the way, I'm on Mapserver 3.6.1 and here's the
> page to go to if you want to see what I'm talking about:
>
> http://cnrit.tamu.edu/maps/map_init.html
>
> Click on the very last button on that page (the one that says
> "FRAMES VERSION" on it). When the map shows up, expand the
> "Regional" folder on the left-hand side to display those layers.
> The one that I'm working on right now is called "Parima Survey
> Households". Click on that layer to load it into the map, then
> you'll see the various symbols I'm referring to show up in the
> legend. I represent the Parima households with red triangle
> symbols and I have different sized triangles depending on how far
> zoomed in you are so that they are small at a high scale and
> larger as you zoom in...but I don't want all versions of that
> symbol to show up in my legend all the time...just the one that's
> in scale.
>
> Thanks again!
>
> Martin, Daniel wrote:
>
>> 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> </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]
>>>Sent: Tuesday, October 01, 2002 10:59 AM
>>>To: Martin, Daniel
>>>Cc: mapserver-user!
>>>s@li!
>>>
>>>sts.gis.u
>>>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 :
>>>>
>>>>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]
>>>>Sent: Mo
>>>>nday, September 30, 2002 5:06 PM
>>>>To: 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 o
>>>>f "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!
>>>>
>>>>
>>>
>>>
>>>
>>
>
--------------040909080007010806040704
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<html>
<head>
</head>
<body>
LAYER<br>
NAME Parima_Surveyhouseholds<br>
GROUP Region<br>
TYPE Point<br>
STATUS off<br>
DATA parima_surveyhouseholds<br>
HEADER 'parima_surveyhouseholds.shp_header.html'<br>
TEMPLATE parima_surveyhouseholds.shp_query.html<br>
<br>
CLASS<br>
MINSCALE 20136780<br>
Name 'Parima Survey Households'<br>
SYMBOL 'triangle'<br>
SIZE 5<br>
COLOR 255 0 0<br>
OUTLINECOLOR 0 0 0<br>
END # CLASS<br>
<br>
CLASS<br>
MINSCALE 10068390<br>
MAXSCALE 20136779<br>
Name 'Parima Survey Households'<br>
SYMBOL 'triangle'<br>
SIZE 8<br>
COLOR 255 0 0<br>
OUTLINECOLOR 0 0 0<br>
END # CLASS<br>
<br>
CLASS<br>
MINSCALE 5034193<br>
MAXSCALE 10068389<br>
Name 'Parima Survey Households'<br>
SYMBOL 'triangle'<br>
SIZE 11<br>
COLOR 255 0 0<br>
OUTLINECOLOR 0 0 0<br>
END # CLASS<br>
<br>
CLASS<br>
MINSCALE 0<br>
MAXSCALE 5034192<br>
Name 'Parima Survey Households'<br>
SYMBOL 'triangle'<br>
SIZE 15<br>
COLOR 255 0 0<br>
OUTLINECOLOR 0 0 0<br>
END # CLASS<br>
<br>
END # LAYER<br>
<br>
Martin, Daniel wrote:<br>
<blockquote type="cite" cite="mid:4ACBA1414DD9EE418CC250E4AAA9035A192B34@STL-EXBE-I03.corp.erac.com">
<meta content="MSHTML 5.50.4613.1700" name="GENERATOR">
<div><span class="692135717-01102002"><font face="Arial" color="#0000ff" size="2">
Could you provide the map file definition for the Parima Survey Households
layer?</font></span></div>
<div><span class="692135717-01102002"></span> </div>
<div><span class="692135717-01102002"><font face="Arial" color="#0000ff" size="2">
Thanks,</font></span></div>
<div><span class="692135717-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 [<a class="moz-txt-link-freetext" href="mailto:nospam@cnrit.tamu.edu">mailto:nospam@cnrit.tamu.edu</a>]<br>
<b>Sent:</b> Tuesday, October 01, 2002 11:56 AM<br>
<b>To:</b> Martin, Daniel<br>
<b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.gis.umn.edu">mapserver-users@lists.gis.umn.edu</a><br>
<b>Subject:</b> Re: [mapserver-users] HTML Legend with Status Checking...<br>
<br>
</font></div>
Same thing. Now I don't have group header bars seperating my layers,
but all the layers still show up and when I click on a layer that has
scale-specific classes, the symbols for all scales still show up. By
the way, I'm on Mapserver 3.6.1 and here's the page to go to if you want
to see what I'm talking about:<br>
<br>
<a class="moz-txt-link-freetext" href="http://cnrit.tamu.edu/maps/map_init.html">
http://cnrit.tamu.edu/maps/map_init.html</a>
<br>
<br>
Click on the very last button on that page (the one that says "FRAMES
VERSION" on it). When the map shows up, expand the "Regional" folder
on the left-hand side to display those layers. The one that I'm working
on right now is called "Parima Survey Households". Click on that layer
to load it into the map, then you'll see the various symbols I'm referring
to show up in the legend. I represent the Parima households with red
triangle symbols and I have different sized triangles depending on how
far zoomed in you are so that they are small at a high scale and larger
as you zoom in...but I don't want all versions of that symbol to show
up in my legend all the time...just the one that's in scale.<br>
<br>
Thanks again!<br>
<br>
Martin, Daniel wrote:<br>
<blockquote cite="mid:4ACBA1414DD9EE418CC250E4AAA9035A16F347@STL-EXBE-I03.corp.erac.com" type="cite">
<meta content="MSHTML 5.50.4613.1700" name="GENERATOR">
<div><span class="328113416-01102002"><font face="Arial" color="#0000ff" size="2">
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.</font></span></div>
<div><span class="328113416-01102002"></span> </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 [<a class="moz-txt-link-freetext" href="mailto:nospam@cnrit.tamu.edu">
mailto:nospam@cnrit.tamu.edu</a>
]<br>
<b>Sent:</b> Tuesday, October 01, 2002 11:33 AM<br>
<b>To:</b> Martin, Daniel<br>
<b>Cc:</b><a class="moz-txt-link-abbreviated" href="mailto:mapserver-users@lists.gis.umn.edu">
mapserver-users@lists.gis.umn.edu</a>
<br>
<b>Subject:</b> Re: [mapserver-users] HTML Legend with Status
Checking...<br>
<br>
</font></div>
Gladly. Here is my legend code:<br>
<br>
[leg_group_html]<br>
<tr><br>
<td colspan=3 bgcolor=#cccccc><b>[leg_group_name]</b></td><br>
</tr><br>
[/leg_group_html]<br>
<br>
[leg_layer_html]<br>
[/leg_layer_html]<br>
<br>
[leg_class_html]<br>
<tr><br>
<td width=15>&nbsp;</td><br>
<td><br>
<img src="[leg_icon width=15 height=15]" width=15
height=15><br>
</td><br>
<td><br>
[leg_class_name]<br>
</td><br>
</tr><br>
[/leg_class_html]<br>
<br>
<br>
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:<br>
<br>
LAYER<br>
NAME "Ethiopia_Rivers"<br>
TYPE LINE<br>
STATUS off<br>
GROUP Ethiopia<br>
DATA "ethiopia_rivers"<br>
HEADER 'ethiopia_rivers.shp_header.html'<br>
CLASS<br>
MAXSCALE 8710165<br>
Name 'Ethiopia Rivers'<br>
COLOR 102 204 255<br>
TEMPLATE ethiopia_rivers.shp_query.html<br>
END # CLASS<br>
END # 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. 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.<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><TR><br> <TD><br> <img src="[leg_icon]" border=0><br> </TD><br> <TD> <br> <font face="arial" size=2>[leg_class_name]</font><br> </TD><br></TR><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-user!<br>
s@li!<br><br>sts.gis.u<br>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.!<br>tamu!<br>.ed
u</a>]<br>Sent: Mo<br>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!<br> there
's no status o<br>f "SCALE" to <br>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>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>
--------------040909080007010806040704--