(intermittent) poor text quality on ANNOTATION layers

Steve Lime Steve.Lime at DNR.STATE.MN.US
Fri Nov 10 09:23:10 EST 2006


Hal: The label cache is drawn by $map->draw() so the drawlabelcache call
is unecessary and probably
the source of your problems. The only reason to use drawlabelcache at
all is if you are using
layer or feature level draws since those populate the cache but don't
draw it.

Steve

>>> Hal Mueller <hal at MOBILEGEOGRAPHICS.COM> 11/10/06 2:31 AM >>>
Well I apparently don't understand how the label cache works.  That 
is in fact the cause of my problems.  i can cure or cause the error 
by not calling or calling $map->drawlabelcache().

http://www.sailwx.info/shiptrack/maptest.phtml has a much-simplified 
test case done with PHP Mapscript.

The upper map has fuzzy text.  The lower map is correct.  The only 
difference is a call to drawlabelcache() in the fuzzy-text map.

The maps are generated with

   $image=$map->draw();
   $map->drawlabelcache($image);
   $url=$image->saveWebImage();
   echo "<img src=\"$url\">";

   $image2=$map2->draw();
   $url2=$image2->saveWebImage();
   echo "<img src=\"$url2\">";

The complication is that for the real maps, I have both static data 
(defined in shapefiles and .map file) and dynamic data (rendered onto 
the map after the base map has been drawn).

The flow of the programs is (distilled down):
$map = ms_newMapObj()
$image = $map->draw();
$dynamicLayer = $map->getLayerByName("dynamic");

and then many calls to
$point->draw($map, $dynamicLayer, $image...);

If I delete the call to drawlabelcache(), my annotations on the 
dynamic data are lost.  If I keep the call to drawlabelcache() the 
static layers are labeled twice.  What am I missing?  Is there a 
better approach?

Hal



More information about the mapserver-users mailing list