PHP/MapScript: How to create annotations

Julien-Samuel Lacroix jlacroix at DMSOLUTIONS.CA
Tue Oct 11 09:51:04 EDT 2005


Hi,
You can do this by drawing a point on the map image with an annotation 
layer.

<?php
[...]
$pixLayer = $gpoMap->getLayerByName("annotation");
$pixLayer->set("status", MS_ON);
$titleLocation = ms_newPointObj();
$titleLocation->setXY($gpoMap->width/2, 20);

$img = $gpoMap->draw();

$titleLocation->draw($gpoMap, $pixLayer, $img, "MainTitle",
                      "insert text here");
?>

Layer in mapfile:
LAYER
   NAME "annotation"
   TYPE ANNOTATION
   TRANSFORM FALSE
   STATUS OFF
   LABELCACHE OFF
   CLASS
     NAME "MainTitle"
     COLOR -1 -1 -1
     LABEL
       TYPE BITMAP
       SIZE GIANT
       COLOR 0 0 0
       OUTLINECOLOR 255 255 255
       POSITION CC
     END
   END
END # layer

Cheers,
Julien

On 10/07/2005 08:32 AM, Mapserver Mailing-List wrote:
> Hi List,
> 
> I would like to add some legal text,image key, and copyright information 
> onto a GeoTIFF images. I succeed to add static text by defining it in 
> the mapfile. But I must also add some dynamic text, such as generated 
> image's name.
> 
> So how can I create and place annotations on a map with PHP/Mapscript ?
> 
> Thanks in advance for your help. Regards.
> 
> Richard Barahona
> 

-- 
------------------------------------------------------------
Julien-Samuel Lacroix            jlacroix at dmsolutions.ca
DM Solutions Group               http://www.dmsolutions.ca/
------------------------------------------------------------



More information about the mapserver-users mailing list