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

Eric Bridger eric at GOMOOS.ORG
Mon Nov 29 06:32:40 PST 2004


I have used Manfred's method, but only after doing a:
my $style = $class->getStyle(0);
$style->{color} = $c;

since there can be more than one style per class.

You can also use:
$style->{color}->setRGB(0,0,0);



On Mon, 2004-11-29 at 00:01, Manfred Meier wrote:
> I don't know if that helps, i tried a long time ago something like:
>
> my $c = new mapscript::colorObj(255,0,0);
> $class->{styles}->{color} = $c;
>
> This did it for me and when I remember right, the setting with ->{red},
> ->{green} and ->{blue} didn't work.
>
>
>
> Joseph Norris schrieb:
>
> > Come on!!!! Does anyone out there set color with perl/mapscript? I can do a
> > class->setExpression("/lkasjdfkj/") - at least I think it is working - no
> > errors however I can not set the color so that my map reflects that the
> > regex was found?  I just know that someone out there has got it to work.
> > Please and 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);
> >
> > -----Original Message-----
> > From: UMN MapServer Users List [mailto:MAPSERVER-USERS at lists.umn.edu]On
> > Behalf Of Joseph Norris
> > Sent: Saturday, November 27, 2004 10:03 PM
> > To: MAPSERVER-USERS at lists.umn.edu
> > Subject: [UMN_MAPSERVER-USERS] going crazy on setting the colors of my zip
> > polygons via perl mapscript
> >
> > 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