[Mapserver-users] Show/hide labels with LABELMINSCALE & LABELMAXSCALE

Stefan Schwarzer stefan.schwarzer at grid.unep.ch
Fri Jan 10 07:02:40 EST 2003


--=====================_159506958==.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hi Steve,

naturally the value you use to set the limits for the labels depend on your 
files. Here is an example of labeling the capitals of all countries. In 
full extent mode the user won't see the labels but the points. Only if one 
zooms into the map to a certain degree, the labels will be displayed. 
Labelminscale would be used to hide the labels again if the user would zoom 
in too much. But I didn't use this option as it doesn't make sense in this 
case. I figured out the value just by trial-and-error....

Hope this helps.

Stefan


LAYER
   NAME capital
   TYPE POINT
   DATA capitals
   STATUS DEFAULT
   LABELITEM 'name'
   LABELMAXSCALE 80000000
   CLASSITEM 'status'
   CLASS
     EXPRESSION 'National capital'
     SYMBOL 'circle'
     SIZE 3
     COLOR 250 50 10
     LABEL
       OFFSET 5 -8
       SIZE TINY
       COLOR 230 230 100
       POSITION CC
     END
   END
END


>I wish to only show the road labels when the map reaches a pre-determiend 
>scale.I've searched the archives and still baffled.
>
>I realize that this should be a straight forward task, but it has defeated 
>me (new to this subject). I load the same
>shp files into ArcView and get an idea of when I wish to show/hide the 
>labels by playing around with the minumun and maximum
>scale values (withn theme->properties dialog). However, nothing seems to 
>work on my mapserver. I'm not using php, just wish to set
>it up in the map file.
>
>I had originally had the labelling as part of the layer and then created a 
>separate annotation layer - still did'nt work.
>
>I'll give you my single layer and see if anyone can assist me on 
>showing/hiding the labels for the roads -
>
>LAYER
>   NAME "roads"
>   STATUS OFF
>   DATA ROAD_GPS
>   LABELITEM "Road_name"
>   #LABELMINSCALE ????---> Can't figure out what values to set
>   #LABELMINSCALE ????---> Can't figure out what values to set
>   TYPE LINE
>   CLASS
>     COLOR 0 0 255
>     LABEL
>         TYPE TRUETYPE
>          #ANTIALIAS
>  FONT arial
>         COLOR 0 0 0
>  OUTLINECOLOR 220 220 220
>  SIZE 8
>  #SIZE MEDIUM
>  ANGLE AUTO
>  POSITION UC
>  OFFSET 0 2
>  buffer 2
>     END#label
>   END
>END # roads

         _______________________________________

         Stefan Schwarzer
         Consultant on GEO

         UNEP/DEWA/GRID-Geneva
         Chemin des Anemones 11
         CH - 1219 Chatelaine
         Switzerland

         Tel: (+41) 22.917.83.49
         Fax: (+41) 22.917.80.29

         Email: stefan.schwarzer at grid.unep.ch
         Internet: http://geodata.grid.unep.ch/
         _______________________________________ 
--=====================_159506958==.ALT
Content-Type: text/html; charset="us-ascii"

<html>
<body>
<font size=3>Hi Steve,<br><br>
naturally the value you use to set the limits for the labels depend on
your files. Here is an example of labeling the capitals of all countries.
In full extent mode the user won't see the labels but the points. Only if
one zooms into the map to a certain degree, the labels will be displayed.
Labelminscale would be used to hide the labels again if the user would
zoom in too much. But I didn't use this option as it doesn't make sense
in this case. I figured out the value just by
trial-and-error....<br><br>
Hope this helps.<br><br>
Stefan<br><br>
<br>
LAYER<br>
&nbsp; NAME capital<br>
&nbsp; TYPE POINT<br>
&nbsp; DATA capitals<br>
&nbsp; STATUS DEFAULT<br>
&nbsp; LABELITEM
'name'<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
&nbsp; LABELMAXSCALE 80000000<br>
&nbsp; CLASSITEM 'status'<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; EXPRESSION 'National capital'<br>
&nbsp;&nbsp;&nbsp; SYMBOL 'circle'<br>
&nbsp;&nbsp;&nbsp; SIZE 3<br>
&nbsp;&nbsp;&nbsp; COLOR 250 50 10<br>
&nbsp;&nbsp;&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OFFSET 5 -8<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SIZE TINY<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 230 230 100<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; POSITION CC<br>
&nbsp;&nbsp;&nbsp; END<br>
&nbsp; END<br>
END<br><br>
<br>
</font><blockquote type=cite class=cite cite><font face="arial" size=2>I
wish to only show the road labels when the map reaches a pre-determiend
scale.I've searched the archives and still
baffled.</font><font size=3><br>
&nbsp;<br>
</font><font face="arial" size=2>I realize that this should be a straight
forward task, but it has defeated me (new to this subject). I load the
same<br>
shp files into ArcView and get an idea of when I wish to show/hide the
labels by playing around with the minumun and maximum<br>
scale values (withn theme-&gt;properties dialog). However, nothing seems
to work on my mapserver. I'm not using php, just wish to set<br>
it up in the map file.</font><font size=3><br>
&nbsp;<br>
</font><font face="arial" size=2>I had originally had the labelling as
part of the layer and then created a separate annotation layer - still
did'nt work.</font><font size=3><br>
&nbsp;<br>
</font><font face="arial" size=2>I'll give you my single layer and see if
anyone can assist me on showing/hiding the labels for the roads -
</font><font size=3><br>
&nbsp;<br>
</font><font face="arial" size=2>LAYER<br>
&nbsp; NAME &quot;roads&quot;<br>
&nbsp; STATUS OFF<br>
&nbsp; DATA ROAD_GPS<br>
&nbsp; LABELITEM &quot;Road_name&quot;&nbsp; <br>
&nbsp; #LABELMINSCALE ????---&gt; Can't figure out what values to
set<br>
&nbsp; #LABELMINSCALE ????---&gt; Can't figure out what values to
set<br>
&nbsp; TYPE LINE<br>
&nbsp; CLASS<br>
&nbsp;&nbsp;&nbsp; COLOR 0 0 255<br>
&nbsp;&nbsp;&nbsp; LABEL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TYPE TRUETYPE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #ANTIALIAS<br>
&nbsp;FONT arial<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COLOR 0 0 0<br>
&nbsp;OUTLINECOLOR 220 220 220<br>
&nbsp;SIZE 8<br>
&nbsp;#SIZE MEDIUM<br>
&nbsp;ANGLE AUTO<br>
&nbsp;POSITION UC<br>
&nbsp;OFFSET 0 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;buffer 2<br>
&nbsp;&nbsp;&nbsp; END#label<br>
&nbsp; END<br>
END # roads</font></blockquote>
<x-sigsep><p></x-sigsep>
<font size=3><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________<br><br>
</font><font size=2><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><b>Stefan
Schwarzer<br>
</b><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Consultant
on GEO<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Chemin des
Anemones 11<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CH - 1219
Chatelaine<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Switzerland<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>Internet:
<a href="http://geodata.grid.unep.ch/" eudora="autourl">http://geodata.grid.unep.ch/</a><br>
</font><font size=3><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>_______________________________________</font></body>
</html>

--=====================_159506958==.ALT--





More information about the mapserver-users mailing list