[mapserver-users] PHP Mapscript, label with self created text

Milo van der Linden milo at dogodigi.net
Wed Feb 23 16:25:21 EST 2011


Hi Nicol,

Excellent! It works! Now I only have one more issue:

http://www.dogomaps.net/bikkels/index.html?zoom=9&lat=385827.82031&lon=174867.38281&layers=B

The label is duplicated due to the fact that I am retrieving tiles. Any
experience with that?

2011/2/23 Nicol Hermann <mapserver at geoworld.de>

> Hi Milo,
>
> Try:
> $theme_class[$i]->settext($v);
>
> http://mapserver.org/mapscript/php/index.html#classobj
>
> HTH
> Nicol
>
>
> Am Mittwoch, den 23.02.2011, 16:19 +0100 schrieb Milo van der Linden:
> > 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++;
> >     }
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110223/c73df80a/attachment.html


More information about the mapserver-users mailing list