[Mapserver-users] Problem coloring layer
Sam Choudry
samuzzal at linux.net
Mon May 3 00:53:16 PDT 2004
Hello,
Here is the same old problem still not solved. I want to change the
color of my area layer "nal-blk" according to user input. For that I am
using the code:
if($r!='' && $g!='' && $b!='')
{
$layer = $map->getlayerbyname("nal-blks");
$class = $layer->getclass(0);
$layer->open($map->shapepath);
$index = findindex($r,$g,$b);
$class->set('color',index);
}
I am using a function I received from one of the list members,
function findindex($r,$g,$b)
{
GLOBAL $map;
$r1=(int) $r;
$g1=(int) $g;
$b1=(int) $b;
for($i=-10;$i<0;$i++)
{
$col=$map->getColorByIndex($i);
$tr=$col->red;
$tg=$col->green;
$tb=$col->blue;
if(($r1 == $tr) && ($g1 == $tg) && ($b1 == $tb))
{
$in=$i;
break;
}
}
$in=$in+1;
return($in);
}
The Error message are :
Warning: Wrong parameter count for open() in
c:\inetpub\wwwroot\php\nalbari.php on line 21
Fatal error: Property 'color' does not exist in this object.
in c:\inetpub\wwwroot\php\nalbari.php on line 23
The Map File snippet is also provided:
LAYER #DISTRICT BLOCKS#
NAME "nal-blks"
DATA nal-blks
STATUS ON
TYPE POLYGON
CLASS
NAME '0'
COLOR 219 250 253
OUTLINECOLOR 154 181 250
END
END
What can be the possile solution to this? Regards,
Samuzzal
_____________________________________________________________
Linux.Net -->Open Source to everyone
Powered by Linare Corporation
http://www.linare.com/
More information about the MapServer-users
mailing list