Mapscript adding class with PHP
Arie Mijnlieff
mijnlief at XS4ALL.NL
Wed Oct 4 01:06:28 PDT 2006
Hi Murat !
No this doesnt solve the problem:
PHP Fatal error: Call to a member function on a non-object in /var/
www/html/mapdemo/bulgaria/test.php on line 13
color is not an attribute of the class object.. Maybe i should try to
define a new layer with php for each country that i would like to
paint..
Thanks for your suggestion !
Arie
On 4-okt-2006, at 8:38, Murat BEYHAN wrote:
> 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