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

Simpson asimpson at I-55.COM
Mon Nov 29 05:06:06 PST 2004


I think if you dynamically create your class objects you need to manually
keep track of the 'numstyles' property.
Try setting 'numstyles' to 1 like so:

$class->{numstyles} = 1;

Drew.

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
Behalf Of Joseph Norris
Sent: Sunday, November 28, 2004 6:48 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] going crazy on setting the colors of
my zip polygons via perl mapscript


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