[Mapserver-users] Error in getSymbolByName

Your Name nuno.cabrita at elementodigital.pt
Tue Jul 1 14:09:17 EDT 2003


Hello all. I am trying to set diferent symbols to point shapes in a 
layer, but after adding 50 symbols the function 

$map->getSymbolByName($filename)

returns -1 and the symbol does not apear in the map.

Here is a piece of my code:

  $layer = ms_newLayerObj($Map);
  $layer->set("name", 'graph');
  $layer->set("type", MS_LAYER_POINT);
  $layer->set("status", 1);

  $shape_file = ms_newShapefileObj($Map->shapepath.'/graph', 
MS_SHP_POINT);
  $dbfFile = dbase_create($Map->shapepath."/graph.dbf",
      array(array("IGDS_CLASS", "C", 150, 0), array("VALOR", "C", 150, 
0)));

  $idx_class = 0;
  while ($j<52) {
      $class = ms_newClassObj($layer);
      $class->set("name", "class_name");
      $class->setexpression("'".$idx_class."'");
      
      $class->set("symbolname", $path.$idx_class.".png");

      $pt = ms_newPointObj();
      $pt->setXY($long + 50, $lat+120);

      $line = ms_newLineObj();
      $line->add($pt);

      $shape = ms_newShapeObj(MS_SHAPE_POINT);
      $shape->add($line);
    
      $shape_file->addShape($shape);

      dbase_add_record($dbfFile, array($idx_class, 0));
      $idx_class++;
  }

  $shape_file->free();
  dbase_close($dbfFile);
  $layer->set('classitem', 'IGDS_CLASS');
  $layer->set('data', 'graph');


Is this a bug of mapserver?
Am I doing something wrong?
Is there a better way to do this?

Can anyone please help me?




More information about the mapserver-users mailing list