[mapserver-users] PHP Mapscript, label with self created text
Milo van der Linden
milo at dogodigi.net
Wed Feb 23 07:19:04 PST 2011
Hello people,
I have created a piece of mapscript that takes a key/value pair and creates
class-coloring according to this. This works perfectly well except for one
tiny little thing:
I want to add $v as a label to my classes.
My question is: Is it possible to assign static text to a label? Because if
it is not; I would have to query the underlying layer for it's centroid and
create a text label on top of that layer.
For instance something like:
$theme_label[$i]->set("labeltext", $v);
foreach ($mycollection as $k=>$v) {
$theme_class[$i]=ms_newClassObj($theme_layer);
$theme_class[$i]->setExpression($k);
$theme_class[$i]->set("name",
$theme_class[$i]->getExpressionString());
$theme_style[$i]=ms_newStyleObj($theme_class[$i]);
$tc = $theme->getColourValue($v);
$theme_style[$i]->color->setRGB($tc[0],$tc[1],$tc[2]);
$theme_style[$i]->outlinecolor->setRGB(255,255,255);
//$theme_label[$i]=ms_newLabelObj($theme_class[$i]);
//$theme_label[$i]->set("font", "sans");
//$theme_label[$i]->set("type", "truetype");
//$theme_label[$i]->set("size", 10);
//$theme_label[$i]->set("labeltext", $v);
$i++;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110223/4fc21a95/attachment.htm>
More information about the MapServer-users
mailing list