[Mapserver-users] can I use different symbols in the samedynamic layer?

Frieso ter Haseborg ter-haseborg at sf-datentechnik.de
Wed Sep 24 05:27:03 EDT 2003


Hi,

one more question: Can't I change the color the same way? After
successfully using different symbols, I tried to change the color of the
symbols also. But a color-change only takes effect for the first change
resp. for the first symbol drawn. All subsequent symbols are drawn in
_this_ new color also, but not in the individual color specified for
each symbol.

My PHP/MapScript goes like this:
$sym1 = $map->getSymbolByName ( "excl" );
$sym2 = $map->getSymbolByName ( "tent" );
$class = $layer->getClass (0);
$style = $class->getStyle(0);

// first point
$style->color->setRGB(0, 0, 255); // now the next point will change to
blue 
					    // (symbols in mapfile are
initialized in red)
					    // THIS CHANGE WORKS!
$style->set ( 'symbol', $sym1 );
$pt = ms_newPointObj();
$pt->setXY( 2100000, 10100000 );
$pt->draw($map, $layer, $image, 0, "Pt1");

// second point
$style->color->setRGB(0, 255, 0); // now the next point IMO should
become green, but it doesn't, it stays blue
					    // THIS CHANGE FAILES!
$style->set ( 'symbol', $sym2 );
$pt = ms_newPointObj();
$pt->setXY( 4400000, 10000000 );
$pt->draw($map, $layer, $image, 0, "Pt2");


Am I overlooking something or is there any restriction I ran into?

TIA,
 
Frieso ter Haseborg
- Software Development - 
 
--

-------------------------------------------------- 
S&F Datentechnik GmbH&Co.KG 
Reimersstr. 41b 
26789 Leer, Germany



>-----Original Message-----
>From: Frieso ter Haseborg 
>Sent: Wednesday, September 24, 2003 9:52 AM
>To: Eric Bridger
>Cc: mapserver-users at lists.gis.umn.edu
>Subject: RE: [Mapserver-users] can I use different symbols in the
>samedynamic layer?
>
>
>Hi Eric,
>
>thanx, yes this helped a lot. It works - but so far only, when 
>using the StyleObj-Class.
>
>I did the following in PHP:
>
>$sym1 = $map->getSymbolByName ( "excl" );
>$sym2 = $map->getSymbolByName ( "tent" );
>$class = $layer->getClass (0);
>$style = $class->getStyle(0);
>
>$style->set ( 'symbol', $sym1 );
>[...]//draw point1
>
>$style->set ( 'symbol', $sym2 );
>[...]//draw point2
>
>It looks like the symbol attribute is obsolete in MS and 
>PHP/MapScript version 4.0, though no error is raised. It 
>simply effects nothing in my configuration. Which version do you use?
>
>Anyway it works, thanx again!
>
>Best regards,
> 
>Frieso ter Haseborg
>- Software Development - 
> 
>--
>
>-------------------------------------------------- 
>S&F Datentechnik GmbH&Co.KG 
>Reimersstr. 41b 
>26789 Leer, Germany
> 
>
>
>




More information about the mapserver-users mailing list