[Mapserver-users] change style dynamically - getstyle

Sean Gillies sgillies at frii.com
Mon Jun 14 08:14:58 PDT 2004


On Jun 14, 2004, at 7:14 AM, Sylvain Beorchia wrote:

> Hi list,
>
> I try to change the symbology of my object dynamically inside my PHP 
> code, i
> try this :
>
>
> $sym1 = $gpoMap->getSymbolByName ( "BF125" );
> $class = $oLayer->getClass (0);
> $style = $class->getStyle(0);
> $style->color->setRGB(0, 255, 0);
> $style->set ( 'symbol', $sym1 );
> $pt = ms_newPointObj();
> $pt->setXY( 2100000, 10100000 );
> $pt->draw($gpoMap, $oLayer, $image, 0, "Pt1");
>
> This code is supposed to add a point on my layer according to the 
> symbology
> i try to set.
> But i've got this error :
>
>   Fatal error: Call to undefined function: getstyle() in
> C:\epcenter\pub\htdocs\gmap.php3 on line 984
>
> Is GetStyle always available ? I'm using Mapserver 4, Apache 2 , PHP 4.
>
> Thanks.
> Sylvain.
>

No.  New and multiple styles are only available in 4.2.

The work around for version 4.0 is to substitute

     $style = $class->styles;

for

     $style = $class->getStyle(0);

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies




More information about the MapServer-users mailing list