Mapscript adding class with PHP
Arie Mijnlieff
mijnlief at XS4ALL.NL
Tue Oct 3 12:35:33 PDT 2006
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
More information about the MapServer-users
mailing list