[Mapserver-users] PHP/MapScript - Changing of shape color on-the-fly ?!?!?!?

Josef Stromský Josef.Stromsky.hgf at vsb.cz
Fri Sep 19 09:48:03 EDT 2003


Hi folks.

Im trying to change color of single shapes during drawing, but it doesnt
work. I`ve tried it according to example from
http://mapserver.gis.umn.edu/doc36/phpmapscript-class-guide.html#FAQ but
nothing. Result is empty raster everytime.  My code to change color of every
shape is:

$imageQuery = $mapFile->prepareImage();

$newColor = $mapFile->addColor(250,40,245);
$transClass = $layer->getClass(0);
$transClass->set('color',$newColor);


$layer->open($shpFile);
for($i=1;$i<dbase_numrecords($db)+1;$i++){
     $rec = dbase_get_record($db,$i);
         for($j=0;$j<dbase_numfields($db);$j++){
         if(condition){
               $myShape = $layer->getShape(-1,$i-1);
               $myShape->draw($mapFile, $layer, $imageQuery,0,"any label");
         }
     }
}

$imageQuery->saveWebImage(MS_GIF, 0, 0, 0);     // save image


Thanx in advance.

Josef Stromsky






More information about the mapserver-users mailing list