[mapserver-users] creating classes with mapscript
Daniel Morissette
morissette at dmsolutions.ca
Thu Dec 27 19:56:08 PST 2001
Nicolau Werneck wrote:
>
> ... but this piece of PHP/MapScript code doesn't
> deliver the same results. The map is displayed as if
> the class is empty. The layer definition if there on
> the .map, but no classes are defined on it:
>
> $cla =
> ms_newClassObj($map->getLayerByName("empresas"));
> $cla->setexpression("'3144508'");
> $cla->label->type=MS_TRUETYPE;
> $cla->label->font="verdanai";
> $cla->label->size=7;
> $cla->label->color=$cor;
> $cla->label->position=MS_UL;
>
> shouldn't it give the SAME results?
>
The first step would be to make sure that you use the set() method to
set your class label parameters. Simply setting the PHP object member
variables with direct assignments doesn't propagate the values to the
underlying classes in the MapServer core.
$cla = ms_newClassObj($map->getLayerByName("empresas"));
$cla->setexpression("'3144508'");
$cla->label->set("type", MS_TRUETYPE);
$cla->label->set("font", "verdanai");
$cla->label->set("size", 7);
$cla->label->set("color", $cor);
$cla->label->set("position", MS_UL);
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list