[Mapserver-users] PHP Mapscript - Can't label dynamic point

mose mose at mose.fr
Sat Dec 21 03:50:17 PST 2002


le Fri, Dec 20, 2002 at 10:22:47PM -0600 par Hankley, Chip :
> Folks... I'm using the following code to dynamically generate a point in a
> map.
> 
> I'm having trouble getting the labeling to work. In the following code, I'm
> passing the variable $address_text (which I've checked IS a valid
> string)...however, no text is rendering in the image (although the point IS
> rendering).
> 
> What am I missing?

- I think you should give a labelitem to your layer 
  in order to display that label :

  $qryLyr->set("labelitem","dynamic label");

hope that helps,
mose


> 
> Chip
> 
> //create a layer in which to put the address pin-point
>   $AddressLayer = createPushPinLyr($map);
> //create a point to display
>   $AddressPoint = createPushPin($addXY);
> //generate a map
>   $img = $map->draw();
>   $AddressPoint->draw($map, $AddressLayer, $img, 0, $address_text);
> 
> function createPushPinLyr($map) {
>   //create a dynamic layer in which to display the selectd record
>   $qryLyr = ms_newLayerObj($map);
>   $qryLyr->set("status", MS_ON);
>   $qryLyr->set("name", "AddressPushPin");
>   $qryLyr->set("type", MS_LAYER_POINT);
>   $qryLyrClass = ms_newClassObj($qryLyr);
>   $qryLyrClass->set("color", $map->addColor(255, 255 ,0));
>   $qryLyrClass->set("symbol", 1);
>   $qryLyrClass->set("size", 25);
>   $qryLyrClassLbl = $qryLyrClass->label;
>   $qryLyrClassLbl->set("type", MS_BITMAP);
>   $qryLyrClassLbl->set("color", $map->addColor(255, 0 ,0));
>   $qryLyrClassLbl->set("size", MS_SMALL);
>   $qryLyrClassLbl->set("offsetx", 10);
>   $qryLyrClassLbl->set("offsety", 10);
> 
>   return($qryLyr);
> }
> function createPushPin($addXY) {
>   $pointObj = ms_newPointObj();
>   $pointObj->setxy($addXY[0], $addXY[1]);
>   return $pointObj;
> }
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list