[mapserver-users] PHP mapscript: drawing labels as top layer

Jim Sproull sproull.j at emstechnologies.ca
Fri Nov 29 14:39:15 EST 2002


Daniel,

 I had thought that drawing all layers separately would have drawn the
labels, too.  But you're right, using this method, the cache doesn't get
drawn unless you explicitly call it.  Thanks for the tip!  This shaved
almost 1/2 off the execution time. :)
 Has it been discussed to include this as an attribute to layerObj? 
drawlabelcache = true or something similar?  Or is that getting too
obtuse?

Thanks again,
Jim

On Fri, 2002-11-29 at 14:13, Daniel Morissette wrote:
> Jim,
> 
> Have you considered looping through all layers to draw each one in turn,
> then drawing your shape, and finally drawing the label cache:
> 
>   $img = $this->mapObject->prepareImage();
>   for($i=0; $i<$this->mapObject->numLayers; $i++)
>   {
>     $layer = $this->mapObject->getLayer($i);
>     $layer->draw($img);
>   }
> 
>   // My own method to get a particular shape
>   $Layer = ...
>   $Shape = $this->getShape();
>   $Shape->draw($this->mapObject, $Layer, $img);
>   
>   $this->mapObject->drawLabelCache($img);
>   
> 
> Daniel
-- 
Jim Sproull <sproull.j at emstechnologies.ca>
EMS Technologies




More information about the mapserver-users mailing list