How do I embed any text onto the map

Stefanie Weykam sweykam at TELELINE.ES
Thu Dec 8 02:55:35 PST 2005


Aniruddha,

I have an annotation layer predefined in my map file (see Steve Lime's
example) that dynamically generates the text to be shown and it's location
in the map (which depends on the legend height). This is the PHP/MapScript
code:

   $LegTit1=$map->getLayerByName('TitLeyenda1fila');
   $oP=ms_newPointObj();                 
   $oL=ms_newLineObj();
   $shape=ms_newShapeObj(MS_SHAPE_POINT);
   if ($data_val[T_COD50]!="")   
       $oP->setXY(492,245);   # long legend
   else
       $oP->setXY(492,264);  # short legend
   $oL->add($oP);
   $shape->add($oL);
   $shape->set('text', $leyenda1);  # $leyenda1=string defined earlier
   $LegTit1->addFeature($shape);                
   $LegTit1->set('status', 1);
   $img=$map->draw();          # requires draw map   
   $LegTit1->draw($img);   

I am also working with species distribution maps. You may check out the
following URL: http://161.111.161.171/Atlas/ The application is in Spanish,
but it is easy to understand. All titles and text are generated and modified
according to the theme which is currently displayed. If you have any
questions regarding how to proceed, just let me know. 
I would also be interested in seeing your application. 

Stefanie



More information about the MapServer-users mailing list