Mapscript adding class with PHP

Murat BEYHAN beyhan at DEPREM.GOV.TR
Wed Oct 4 02:38:25 EDT 2006


Hi Arie,

please try the following in yor php script,
I'm new on PhpMapscript so. I hope this solve your problem





> $new_class = ms_newClassObj($this_layer);
> $new_class->setExpression('Australia');
> $new_class->set('name','Australia');
  $new_class->color->setRGB(255,0,0);////////////////here you should add 
> $new_class->label->outlinecolor->setRGB(255,255,255);
> $new_class->label->set(minfeaturesize,40);

regards

Murat

On Tue, 3 Oct 2006 21:35:33 +0200, Arie Mijnlieff wrote
> Hi,
> 
> I want to show countries in my world map based on a form with  
> checkboxes.
> 
> If I check Argentina and Australia i would like to show both  
> countries in red, whereas the other are in another color. If i 
> change  the selection in Australia and India i would like Australia 
> and India  to be red.
> 
> I have a .map file with a layer called countries. In that layer i  
> have a class:
> 
>     CLASS                   # Start of CLASS object
>        NAME 'Argentina'
>        EXPRESSION 'Argentina'
>        OUTLINECOLOR 100 100 100
> 	  COLOR 255 255 150
>        LABEL
> 	   SIZE LARGE
> 	   OUTLINECOLOR 255 255 255
> 	   MINFEATURESIZE 40
>        END
>      END                     # End of CLASS object
> 
> So i thought if Australia is checked, i add a class object to my  
> layer using php with the same colors:
> 
> $new_class = ms_newClassObj($this_layer);
> $new_class->setExpression('Australia');
> $new_class->set('name','Australia');
> $new_class->label->outlinecolor->setRGB(255,255,255);
> $new_class->label->set(minfeaturesize,40);
> 
> Australia will not be red however. I do not understand how i can  
> change the color of my new class. I succeeded only to change the  
> color of the label.. What do i do wrong ?
> 
> If i change the color of an existing class i can see that change  
> however..
> 
> $my_class = $this_layer->getClass(0);
> $my_class->setExpression('Australia');
> $my_class->set('name','Australia');
> 
> Any help will be appreciated !!
> 
> Arie
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.


--
Open WebMail Project (http://openwebmail.org)


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



More information about the mapserver-users mailing list