unable to change the layer font

Daryl Herzmann akrherz at IASTATE.EDU
Tue Jan 24 14:40:33 PST 2006


On Tue, 24 Jan 2006, krishna S wrote:

> Hello all, i am using php mapscript to label the layer on a map, i am 
> able to set it from the mapfile but when i do it from the php mapscript 
> file it doesnt change the font and the font size, heres how the php 
> mapscript looks like
>
> $map = ms_newMapObj($map_path."states.map");
>
> $layername = $map->getLayerByName("states");
> $layername->set("labelitem","cty_county");
> $class = $layername->getClass(0);
> $style = ms_newStyleObj($class);
> $style->backgroundcolor->setRGB(255,255,255);
> $style->color->setRGB(100,220,220);
> $style->outlinecolor->setRGB(100,0,0);
>
> $class1 = ms_newClassObj($layername);
> $class1->label->set("font","verdana");
> $class1->label->set("size","tiny");

I am not sure what else may be wrong, but you need to use MS_TINY

http://mapserver.gis.umn.edu/docs/reference/mapscript/index_html#label-size-bitmap-only

  $class1->label->set("size", MS_TINY);

the string 'tiny' is not sufficient, IIRC.

daryl

-- 
/**
  * Daryl Herzmann (akrherz at iastate.edu)
  * Program Assistant -- Iowa Environmental Mesonet
  * http://mesonet.agron.iastate.edu
  */



More information about the MapServer-users mailing list