[Mapserver-users] Show/hide labels with LABELMINSCALE & LABELMAXSCALE
Stefan Schwarzer
stefan.schwarzer at grid.unep.ch
Fri Jan 10 04:02:40 PST 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>
NAME capital<br>
TYPE POINT<br>
DATA capitals<br>
STATUS DEFAULT<br>
LABELITEM
'name'<x-tab> </x-tab><br>
LABELMAXSCALE 80000000<br>
CLASSITEM 'status'<x-tab> </x-tab><br>
CLASS<br>
EXPRESSION 'National capital'<br>
SYMBOL 'circle'<br>
SIZE 3<br>
COLOR 250 50 10<br>
LABEL<br>
OFFSET 5 -8<br>
SIZE TINY<br>
COLOR 230 230 100<br>
POSITION CC<br>
END<br>
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>
<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->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>
<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>
<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>
<br>
</font><font face="arial" size=2>LAYER<br>
NAME "roads"<br>
STATUS OFF<br>
DATA ROAD_GPS<br>
LABELITEM "Road_name" <br>
#LABELMINSCALE ????---> Can't figure out what values to
set<br>
#LABELMINSCALE ????---> Can't figure out what values to
set<br>
TYPE LINE<br>
CLASS<br>
COLOR 0 0 255<br>
LABEL<br>
TYPE TRUETYPE<br>
#ANTIALIAS<br>
FONT arial<br>
COLOR 0 0 0<br>
OUTLINECOLOR 220 220 220<br>
SIZE 8<br>
#SIZE MEDIUM<br>
ANGLE AUTO<br>
POSITION UC<br>
OFFSET 0 2 <br>
buffer 2<br>
END#label<br>
END<br>
END # roads</font></blockquote>
<x-sigsep><p></x-sigsep>
<font size=3><x-tab> </x-tab>_______________________________________<br><br>
</font><font size=2><x-tab> </x-tab><b>Stefan
Schwarzer<br>
</b><x-tab> </x-tab>Consultant
on GEO<br><br>
<x-tab> </x-tab>UNEP/DEWA/GRID-Geneva<br>
<x-tab> </x-tab>Chemin des
Anemones 11<br>
<x-tab> </x-tab>CH - 1219
Chatelaine<br>
<x-tab> </x-tab>Switzerland<br><br>
<x-tab> </x-tab>Tel: (+41)
22.917.83.49<br>
<x-tab> </x-tab>Fax: (+41)
22.917.80.29<br><br>
<x-tab> </x-tab>Email:
stefan.schwarzer at grid.unep.ch<br>
<x-tab> </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> </x-tab>_______________________________________</font></body>
</html>
--=====================_159506958==.ALT--
More information about the MapServer-users
mailing list