How to produce labels for dynamic points?
Gavin Simpson
ucfagls at GOOGLEMAIL.COM
Mon Sep 25 09:44:00 PDT 2006
Dear List,
I'm having some trouble working out how to dynamically add information
to a feature object on a dynamically created shape object that will
show up as the labels for the points I have added to the layer.
The layer is defined in my map file, but it is empty. I process the
layer adding new points from a database like so:
for ($i = 0; $row = mysql_fetch_array($samplesQuery); $i++)
{
$pt = ms_newPointObj();
$pt->setXY($row["fullEasting"], $row["fullNorthing"]);
$line = ms_newLineObj();
$line->add($pt);
$shape = ms_newShapeObj(MS_SHAPE_POINT);
$shape->add($line);
$shape->set("index", $i);
$shape->set("text", $row["siteCode"]);
$layer->addFeature($shape);
$pt->draw($map, $layer, $image, 0, $row["siteCode"]);
}
What do I need to turn on in my map file or what do I have to do in
PHP to set the text for the labels for these dynamically produced
points? My mapfile is appended below.
Many thanks,
Gav
## mapfile
NAME "fumbledatabase"
SIZE 280 350
STATUS ON
SYMBOLSET "/var/www/fwu/maps/symbols/symbols.sym"
#EXTENT -192554.507218 11697.368164 655524.562500 1218637.375000 #54320.312500
EXTENT -192554.507218 0 655524.562500 1225000
IMAGETYPE png24
UNITS METERS
SHAPEPATH "/var/www/fwu/maps/data"
FONTSET "/var/www/fwu/maps/files/fontset.txt"
OUTPUTFORMAT
NAME png24
DRIVER "GD/PNG"
MIMETYPE "image/png"
IMAGEMODE RGB
EXTENSION "png"
END
WEB
IMAGEPATH "/path/to/tmp/"
IMAGEURL "/path/totmp/"
END
SCALEBAR
LABEL
#TYPE truetype
#FONT "luxisansb"
ANTIALIAS true
SIZE small
COLOR 0 0 0
END
TRANSPARENT ON
BACKGROUNDCOLOR 255 255 255
STATUS EMBED
POSITION UL
UNITS KILOMETERS
INTERVALS 3
OUTLINECOLOR 0 0 0
SIZE 150 3
#STYLE 1
END
LAYER
NAME "uklores"
TYPE POLYGON
STATUS ON
DATA "gb_lores"
TRANSPARENCY alpha
CLASS
STYLE
COLOR 255 255 255
OUTLINECOLOR 0 0 0
SYMBOL 0
ANTIALIAS TRUE
END
END
END
LAYER
NAME "ireland"
TYPE POLYGON
STATUS ON
DATA "ireland"
TRANSPARENCY alpha
CLASS
STYLE
COLOR 255 255 255
OUTLINECOLOR 0 0 0
SYMBOL 0
ANTIALIAS TRUE
END
END
More information about the MapServer-users
mailing list