[Mapserver-users] help with ???->draw() mapscript function

Vinko Vrsalovic vinko at cprsig.cl
Wed Aug 13 20:50:46 EDT 2003


On Wed, Aug 13, 2003 at 03:46:05PM -0700, Matt Doggett wrote:
> Well I just discovered a difference...
> 
>   If I use Point->draw() for each of the points individually, the point
> Labels will appear in the final map.  But if I use Layer->draw() (where
> the Layer contains the point shape objects)  the point labels do NOT
> appear.
 
You must set the text and classindex properties of the shapeObj for the
labels to appear as defined in the layer's classObj's (and styleObj's if
MS_VERSION >= 3.7). Example:

$shp = ms_newShapeObj(MS_SHAPE_LINE);
$shp->add($line); //$line is a valid LineObj
$shp->set('text',"MY LABEL");
$shp->set('classindex',0); // Important to choose the class this point
			   // will be rendered in. That's class 0 in
			   // $layer
$layer->addFeature($shp);
$layer->draw(); 

 
-- 
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl



More information about the mapserver-users mailing list