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

Krung Saengpole krung at cad.go.th
Sat Sep 20 00:43:56 PDT 2003


Hi Josef

Do you use version 4.x?  If yes, follow this

$transClass = $layer->getClass(0);
$style=ms_newStyleObj($transClass);
$style->color->setRGB(RColor,GColor,BColor);
....

HTH
Krung.

---------- Original Message ----------------------------------
From: Josef Stromský <Josef.Stromsky.hgf at vsb.cz>
Date:  Fri, 19 Sep 2003 15:48:03 +0200

>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
>
>
>
>_______________________________________________
>Mapserver-users mailing list
>Mapserver-users at lists.gis.umn.edu
>http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
>






More information about the MapServer-users mailing list