[Mapserver-users] PhpMapScript and Labels

Jaroslaw Kowalczyk karas1974 at wp.pl
Fri Jun 13 01:54:22 PDT 2003


Hello,

Maybe someone could help with my probelm. I would like to display labels
using phpmapscript. First I create Layer, Class and than add shapes form
dynamically created shapefile. Shapefile is based on data I store in mySQL
database.

Although this new layer appears correctly (red symbols + black outlines)
labels does not appear at all. What is wrong with my code (bellow)?

Thank you.
Jaroslaw Kowalczyk

//----------------------------------
 $newLayer=ms_newLayerObj($map);
 $newLayer->set(status,MS_ON);
 $newLayer->set(name,"Oferty");
 $newLayer->set(type,MS_LAYER_POINT);
 $newLayer->set(labelitem,"id_oferty");
 $newClass=ms_newClassObj($newLayer);
 $newClass->set(symbol,4);
 $newClass->set(size,15);
 $newClass->set(color,$map->addColor(255, 0, 0));
 $newClass->set(outlinecolor,$map->addColor(0, 0, 0));
  $newClass->{label}->{position}=MS_CC;
  $newClass->{label}->set(color, $map->addColor(0, 0, 0));
  $newClass->{label}->{font}=fritqat;
  $newClass->{label}->{type}=truetype;
  $newClass->{label}->{size}=5;
  $newClass->{label}->{antialias}=true;

$shapefile_temp=ms_newShapefileObj("c:/usr/krasnal/www/edeveloper/map/htdocs
/data/".$shapetempname,-1);
  $l_ofert=$shapefile_temp->{numshapes};
      for ($i=0;($i<$l_ofert);$i++)
      {
         $newShapeObj=ms_newShapeObj(MS_SHAPE_POINT);
       $newShapeObj=$shapefile_temp->getShape($i);
       $newLayer->addFeature($newShapeObj);
       $newShapeObj->free();
      }
      $shapefile_temp->free();




---------------------------
Jaroslaw Kowalczyk
www.ekoprojekt.pl




More information about the MapServer-users mailing list