[mapserver-users] How to show/hide labels?
Hankley, Chip
Chip.Hankley at GASAI.Com
Wed Nov 14 14:29:24 PST 2001
You could have your labels done as a separate layer in the mapfile
(annotation) and then turn that layer on / off based on whatever criteria
you want to use for 'dynamically' showing or hiding labels...
Here's an example of a layer definition from one of my mapfiles that shows
only annotation (the data source is a polygon shapefile)...i.e. this layer
will display only the labels based on the 'feat_name' field of the
shapefile... it WON'T draw the polygon outline, etc.
...
LAYER
NAME "Feat_Labels"
STATUS Default
DATA ml3_feat
LABELCACHE ON
TYPE ANNOTATION
LABELITEM "feat_name"
CLASS
COLOR 255 255 255
LABEL
FORCE TRUE
POSITION CC
SIZE TINY
OUTLINECOLOR 255 255 255
BACKGROUNDCOLOR 255 255 204
BACKGROUNDSHADOWCOLOR 221 221 221
BACKGROUNDSHADOWSIZE 1 1
MINDISTANCE 2
COLOR 0 0 0
WRAP "$"
END
END
END # Annotation Layer
...
In php...
$map = ms_newMapObj("test.map");
$MyLayer = $map->getlayerbyname("Feat_Labels");
$MyLayer->set("status", 1); //display the layer
//OR
$MyLayer->set("status", 0); //hide the layer
Chip
-----Original Message-----
From: Greg Liapis [mailto:gregliapis at hotmail.com]
Sent: Wednesday, November 14, 2001 1:13 PM
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] How to show/hide labels?
Hi all,
I am new to map server and this question may seem a little silly.
Is there a method in PHP/Mapscript to show or hide labels dynamically?
Thanks.
Greg Liapis
Greece
More information about the MapServer-users
mailing list