going crazy on setting the colors of my zip polygons via perl mapscript

Guillaume SUEUR guillaume.sueur at GEOSIGNAL.FR
Sun Nov 28 17:04:47 EST 2004


Hi,

I've experienced the same kind of problem :
$oClass = ms_newClassObj($oLayer);
$oStyle = ms_newStyleObj($oClass);
$oStyle->symbolname = "city";
$oStyle->size = 10;

didn't work...

but

$oClass = ms_newClassObj($oLayer);
$oStyle = ms_newStyleObj($oClass);
$oStyle->set('symbolname','city');
$oStyle->set('size',10);

did.

So I think you should try accessing the properties that way.

Hope that helps

Guillaume

Selon Joseph Norris <sirronj at PACBELL.NET>:

> Group,
>
> I have found several samples of setting the color of a polygon based upon
> class that I come up with this:
>
>     $zip_expression =~ s/\|$//;
>     my $class = new mapscript::classObj($layerObj);
>     $class->setExpression("/$zip_expression/");
>     $class->{styles}->{color}->{red} = 255;
>     $class->{styles}->{color}->{green} = 153;
>     $class->{styles}->{color}->{blue} = 153;
>     $layerObj->draw($map, $img);
>
> However - this is not working.  I am getting the right zip codes but no
> matter what I do I can not get my mapscript to set the color based upon the
> expression. When I was build the map file via perl I could set these just
> fine but now I would like to use the perl->mapscript interface to do this.
>
> What is wrong with the above snippet?
>
> Thanks.
>
>
> #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql) print @c=map chr
> $_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,-68,4,-3,-1,7,1,14,-
> 68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>



More information about the mapserver-users mailing list