[mapserver-users] adding labels via php mapscript

A. Giacomelli andreag at crs4.it
Wed Sep 5 13:32:10 EDT 2001


Hi,

I'm talking about adding labels/annotation dynamically via a
ms_point->draw method.

I know this has already been discussed on the list, and I have the
postings from the archives, but it's not getting to work.
I would appreciate if you could check the code snippets included.

There was also a similar posting a couple of weeks ago, but I think it
is not related to the same version of mapserv, and was referring to
polygons, rather than points, so  I would like to double check...

I am currently working on 3.4 + php4.

TIA for any suggestions,
===============================================

Here goes the code. It's supposed to write MYSTRING in the middle of my
image.
===============================================

PHPmapscript part:
......
$mylayer = $gpoMap->getLayerByName("credits");
$txtp = ms_newpointobj();



$txtp->setXY( $myMap->extent->miny + ($gpoMap->extent->max -
$gpoMap->extent->minx)/2 , $gpoMap->extent->miny + ($gpoMap->ex
tent->maxy -$gpoMap->extent->miny )/2);

//$txtp->draw($myMap,$mylayer,$img,"credits","MYSTRING");
$txtp->draw($myMap,$mylayer,$img,0,"MYSTRING");
......

-------------------------------------------------
MAP file
......
LAYER
   NAME credits 
   TYPE POINT   # TRIED ALSO W/ ANNOTATION
   STATUS ON
   CLASS
     NAME credits
        COLOR 0 0 255
        LABEL
          COLOR 0 0 255
          FORCE TRUE
          TYPE TRUETYPE
          FONT fritqat-italic
          MINSIZE 15
          MAXSIZE 30
        END
   END
END
.....
-- 
=========================================
Andrea Giacomelli
Centre for Advanced Studies, Research and
Development in Sardinia

http://www.crs4.it/~andreag
=========================================



More information about the mapserver-users mailing list