[Mapserver-users] can I use different symbols in thesamedynamiclayer?
Frieso ter Haseborg
ter-haseborg at sf-datentechnik.de
Thu Sep 25 08:00:25 PDT 2003
Hi Eric,
nope, no success so far. I tried this:
[...]
$pt = ms_newPointObj();
$class = $layer->getClass(0);
$style = $class->getStyle(0);
$style->color->setRGB(0, 0, 255); //draw a blue point
$style->set ( 'symbol', $sym1 );
$pt->setXY( 2100000, 10100000 );
$pt->draw($map, $layer, $image, 0, "Pt1");
$class = $layer->getClass (0); //new class instance
$style = $class->getStyle(0); //new style instance
$style->color->setRGB(0, 255, 0); //draw a green one - !this failes,
second symbol becomes blue also!
$style->set ( 'symbol', $sym2 );
$pt->setXY( 4400000, 10000000 );
$pt->draw($map, $layer, $image, 0, "Pt2");
[...]
What am I doing wrong? :-(
TIA,
Frieso
>-----Original Message-----
>From: Eric Bridger [mailto:eric at gomoos.org]
>Sent: Wednesday, September 24, 2003 1:15 PM
>To: Frieso ter Haseborg
>Cc: Mapserver List
>Subject: RE: [Mapserver-users] can I use different symbols in
>thesamedynamiclayer?
>
>
>I wasn't very clear. Not a new class, a new class instance. Or, for
>MS4.0, a new style instance. So your layer would have 1 class and 1
>sytle. For each point you want to draw, in psuedo code:
>$layer = getLayerByName()
>$point = new pointObj(); # the point can be re-used.
>foreach lat, lon {
> $class = $layer->getClass(0);
> $style = $class->getSytle(0);
> # set your style attributes, symbol, color, etc.
> ....
> $point->draw();
>}
>
>On Wed, 2003-09-24 at 15:02, Frieso ter Haseborg wrote:
>> Hi,
>>
>> okay: new color, new class - sounds good, I think. But - here comes
>> another newbie-question - how do I tell the points to which
>class they
>> belong???
>>
>> Doesn't this lead back to the CLASSITEM/EXPRESSION-question or am I
>> missing something?
>>
>> TIA,
>> Frieso
>>
>>
>> >-----Original Message-----
>> >From: Eric Bridger [mailto:eric at gomoos.org]
>> >Sent: Wednesday, September 24, 2003 12:02 PM
>> >To: Frieso ter Haseborg
>> >Cc: Mapserver List
>> >Subject: RE: [Mapserver-users] can I use different symbols in
>> >thesamedynamic layer?
>> >
>> >
>> >You're right Frieso,
>> >I am still using 3.6
>> >
>> >The issue you mention below exists in 3.6 as well. What
>you need to do
>> >is to get a new class for each point and set the color and
>symbol anew.
>> >
>> >On Wed, 2003-09-24 at 09:27, Frieso ter Haseborg wrote:
>> >> 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
>> >> >
>> >> >
>> >> >
>> >> >
>> >>
>> >> _______________________________________________
>> >> 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