Dynamically Adding Labels... Please Help!!

mike bockus mikeisdacoolest at YAHOO.COM
Tue Apr 19 19:23:58 PDT 2005


I'm using the PHP extension and I'm attempting to add
a label given a longitude and latitude to a map.  The
label text will be taken from user input in our web
application.  I've searched for over two days without
finding a solution.  Any help would be greatly
appreciated.  Thanks.


I've tried the following but failed...
$pt = ms_newLineObj();
$pt->addXY(35,50); // do x and y represent latitude
and longitude?
$shape = ms_newShapeObj(MS_SHAPE_POINT);
$shape->set('classindex', 0);
$shape->set('text', "Testing");  // assign the label
$shape->add($pt);
$layer = $map->getLayerByName('line_annotation');
$test=$layer->addFeature($shape);
$shape->draw($map, $layer, $map->draw());
$image = $map->draw();

Here's the mapfile for line_annoatation
LAYER
   NAME line_annotation
   STATUS ON
   TYPE ANNOTATION
   FEATURE
   END
   CLASS
     LABEL
       TYPE TRUETYPE
       FONT arial
       SIZE 10
       COLOR 0 0 0
       POSITION UC
       FORCE TRUE
     END
   END
END

Thanks again.




__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail



More information about the MapServer-users mailing list