adding label to point layer in PHPMapscript

Murat BEYHAN beyhan at DEPREM.GOV.TR
Tue Sep 26 00:56:25 PDT 2006


Dear Friends,

I'have draw point layer by using php. That point only one in the map.
Now I would like to make label for that point as $villagename
I have tried following codes but I think something wrong.
Could you help me What is my mistake...
Regards
Murat 
$villagename='kanamura';
 $map_path="/var/www/html/zone/";
 $map = ms_newMapObj($map_path."zone.map");
 $map->setExtent($nMinX, $nMinY, $nMaxX, $nMaxY); 
 
// create a temp layer to hold our points
$point_layer = ms_newLayerObj($map);
$point_layer->set("name", "$koyadi");
$point_layer->set("type", MS_LAYER_POINT);
$point_layer->set("status", MS_DEFAULT);
$point_layer->setProjection("proj=latlong",MS_TRUE);

// create a class and style for this layer
$point_class = ms_newClassObj($point_layer);
$point_style = ms_newStyleObj($point_class);
$point_symbol = $map->getSymbolByName("cpoint");

$point_style->set("symbol", $point_symbol);
$point_style->set("size", 12);
$point_style->color->setRGB(255,0,255);
$point_style->outlinecolor->setRGB(255,255,0);

$label = $point_class->label;
$label->set("position", MS_CC);
$label->set("font","sans");
$label->set("type",MS_TRUEYPE);
$label->set("size",MS_MEDIUM);
$label->color->setRGB(22,8,3);
$label->backgroundcolor->setRGB(0,0,0);
$label->set(minsize,4);
$label->set(maxsize,100000);

// draw our image without the points
 $ref = $map->drawreferencemap();
 $legend=$map->drawLegend();

$image = $map->draw();

// initialize our point and add it to the map
$point = ms_newPointObj();
$longitude=$lon;// comes from select queries from mysql as a result 
$latitude=$lat;// comes from select queries from mysql as a result

$point->setXY($longitude, $latitude);
$point->draw($map, $point_layer, $image, 0, "");
  $map_url=$image->saveWebImage();
  $ref_url = $ref->saveWebImage();
  $legend_url=$legend->saveWebImage();  
 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060926/72f6d43f/attachment.htm>


More information about the MapServer-users mailing list