[mapserver-users] draw dynamic symbols on one layer

ramses2k ramses2k at gmx.de
Wed Nov 19 07:06:43 PST 2008


Dear List,

I'm trying to change a symbol for ONE point layer called 'poi' dynamically within 
PHP/Mapscript.  After searching the mail archive and trying a 
few variations of what seemed correct, I'm not succedding. The map only shows one type of symbol.LAYER     NAME "poi"     STATUS on     TYPE point      LABELCACHE on     TOLERANCEUNITS METERSEND

php script:

public static function AddPoints ( $map, $qresult ) {

     $this_layer = $map->getLayerByName('poi');  //QueryLayer

     $i = 0;
     foreach($qresult as $row) {
            $poi[$i] = ms_newPointObj();
            $ln[$i] =  ms_newLineObj();
            $shp[$i] = ms_newShapeObj(MS_SHAPE_POINT);
            $poi[$i]->setXY($row[1],$row[2]); 
            $ln[$i]->add($poi[$i]);  
            $shp[$i]->add($ln[$i]);
            $shp[$i]->set(index, $row[0]);

  if ($row[7] == 1)  // show red symbol
   {         
         $class = ms_newClassObj($this_layer);
         $class->set("name",depot_red);
         $class->setExpression("rot");
         $class->set("template",dummy.html);
         $style=ms_newStyleObj($class);
         $style->set("symbolname",depot_red);    //the gif
   }
  else            // show green symbol
   {
         $class = ms_newClassObj($this_layer);
         $class->set("name",depot_green);
         $class->setExpression("green");
         $class->set("template",dummy.html);
         $style=ms_newStyleObj($class);
         $style->set("symbolname",depot_green);   //the gif
    }

        $this_layer->addFeature( $shp[$i] );
        $i++;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20081119/b909276d/attachment.htm>


More information about the MapServer-users mailing list