[mapserver-users] Transparency problem

Alexander Pucher pucher at atlas.gis.univie.ac.at
Fri Nov 15 17:58:00 EST 2002


Hi,

I use PHP/MapScript to render a simple choroplete map using data stored 
in PostGIS.
I have a layer of administative areas, drawn in 5 classes through the 
mapfile with colors stored in a configuration file.
To assign the correct colors to the mapfile, I do this (lets presume a 
blue map):

$bez = $map->getLayerByName(bez);

            $class0 = $bez-> getClass(0);
            
$class0->set("color",$map->addColor($cfg_blue1[0],$cfg_blue1[1],$cfg_blue1[2]));
            $class1 = $bez-> getClass(1);
            
$class1->set("color",$map->addColor($cfg_blue2[0],$cfg_blue2[1],$cfg_blue2[2]));
            $class2 = $bez-> getClass(2);
            
$class2->set("color",$map->addColor($cfg_blue3[0],$cfg_blue3[1],$cfg_blue3[2]));
            $class3 = $bez-> getClass(3);
            
$class3->set("color",$map->addColor($cfg_blue4[0],$cfg_blue4[1],$cfg_blue4[2]));
            $class4 = $bez-> getClass(4);
            
$class4->set("color",$map->addColor($cfg_blue5[0],$cfg_blue5[1],$cfg_blue5[2]));

            $colors = array($cfg_blue1, $cfg_blue2, $cfg_blue3, 
$cfg_blue4, $cfg_blue5);

where all the $cfg... variables are the actual color values in the 
config file.
In the last line, I create an array containing the colors. I use this to 
draw a Legend with the GD functions offered by PHP.
So atfer drawing the map with

$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);

I use a function that takes the recently drawn map as the basemap and 
renders the legend on it using the $colors array.
Everything worked fine until today when I changed the mapfile, setting 
the layer to TRANSPARENCY 30. From this moment, the legend doesn't 
render correct. Normally, it used to draw 5 rectangles, filled with the 
$colors array values (which were the same colors as the ones used in the 
layer classes), but now it filles all legend rectangles with only one color.

How can changing the mapfile influence a PHP function, that has nothing 
to do with this mapfile?

Regards,
alex

-- 
________________________________________________________

Institut fuer Geographie und Regionalforschung
Universitaet Wien
Kartografie und Geoinformation

Departement of Geography and Regional Research
University of Vienna
Cartography and GIS

Universitaetstr. 7, A-1010 Wien, AUSTRIA

Tel: (+43 1) 4277 48644
Fax: (+43 1) 4277 48649
E-mail: alexander.pucher at univie.ac.at

FTP: ftp://ftp.gis.univie.ac.at
WWW: http://www.gis.univie.ac.at/karto
--------------------------------------------------------
Virtual Map Forum: http://www.gis.univie.ac.at/vmf
--------------------------------------------------------

M$ is not the answer. M$ is the question!
No is the answer -- Eric Naggum





More information about the mapserver-users mailing list