[phpMapscript]display the layer but not the label
Julien Bessiere
julien.63 at FREE.FR
Mon Jul 3 15:41:25 PDT 2006
Hi,
I'm building and displaying a layer from php mapscript.
That's work fine except the label that doesn't show up. No error message.
Here is my code, any idea of what i've done wrong?
***************************************************
**** NEW LAYER ************************************
$ilayer = ms_newLayerObj($map);
$ilayer->set("name",$layer_name);
$ilayer->set("type",MS_POINT);
$ilayer->set("status",MS_ON);
$labelitem =
"test"; $ilayer->set("labelitem",$labelitem); $ilayer->setprojection($projType);
****************************************************
***** NEW CLASS ************************************
$classpoint = ms_newClassObj($ilayer);
***** NEW LABEL ************************************
$label = $classpoint->label;
$label->set("position", MS_CC);
$label->set("font","sans");
$label->set("type",MS_TRUEYPE);
$label->set("size",MS_MEDIUM);
$label->color->setRGB(22,8,3);
$label->backgroundcolor->setRGB(0,0,0);
$label->set(minsize,4);
$label->set(maxsize,100000);
***** NEW STYLE *************************************
$stylepoint = ms_newStyleObj($classpoint);
$stylepoint->set("symbolname","rond");
$stylepoint->set("size",10);
$stylepoint->color->setRGB($R,$G,$B);
***** LOOP DRAWING THE POINTS ************************
foreach ($row[4] as $coord){
$poi[$i] = ms_newPointObj();
$long = $coord[0];
$lat = $coord[1];
$poi[$i]->setXY($long,$lat);
$poi[$i]->draw($map, $ilayer, $image, 0, "id");
}
Thx for your help.
Julien
More information about the MapServer-users
mailing list