Mapscript error: Fatal error: Invalid style index - Help?

Alexandre Abramides alexandre at ACQUASOFTWARE.COM.BR
Tue Aug 1 08:11:02 PDT 2006


And before anyone say, I do color with $style->color->setRGB($color[0], $color[1], $color[2]);  after the "switch", forgot to paste it before :p
Anyone?
  ----- Original Message ----- 
  From: Alexandre Abramides 
  To: MAPSERVER-USERS at LISTS.UMN.EDU 
  Sent: Tuesday, August 01, 2006 12:03 PM
  Subject: [UMN_MAPSERVER-USERS] Mapscript error: Fatal error: Invalid style index - Help?


  Can anyone help me?   
  It should color diferent points according to the different codes but it´s always black points in the map..
  Thanks in advance.

    $point = ms_newPointObj();
    $point->setXY($x,$y); 
    $line = ms_newLineObj(); 
    $line->add($point);  
    $feature = ms_newShapeObj(0); 
    $feature->set("text"," "); //
    $feature->add($line);  
    $layer = $map->getLayerByName($layer_name); 
    $layer->addFeature($feature);  

    switch($code){
     case 3:
      $color[0] = 48;
      $color[1] = 255;
      $color[2] = 219;
      $class = ms_newClassObj($layer);
      $style = ms_newStyleObj($class); 
      $class->setExpression('code = 3');
      break;
     case 4:
      $color[0] = 255;
      $color[1] = 48;
      $color[2] = 84;
      $class = ms_newClassObj($layer);
      $style = ms_newStyleObj($class
      $class->setExpression('id = 4');
      break;
      ....
    }


  Alexandre.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060801/b597c910/attachment.htm>


More information about the MapServer-users mailing list