Multiple Symbols and Breadcrumbs

Lowell Filak lfilak at MEDINACO.ORG
Mon Aug 23 10:24:12 EDT 2004


Have you tried placing the most recent point in it's own layer so a
different symbol can be used?

Lowell

The following message was sent by Antonio Agostini
<mapserver at INTERAMERICAN.US> on Tue, 24 Aug 2004 08:56:36 -0500.

> Hi All.
>
> I want to display breadcrumbs showing a vehicle's route. Right now it
works
> with one symbol for all points.
>
> How do I go about showing different symbols depending, for example, on the
> vehicle heading?
>
> I have 16 symbols defined in the map file, "bump0" to "bump15". Headings
> are numbers from 0 to 15. At runtime I build the symbol name and change it
> but it is only taking the last one and renders all points with that one.
>
> Here's some of my map file and code. Any help is greatly appreciated. I'm
> still learning and hope to contribute here very soon.
>
> #16 symbols like this
> SYMBOL
>  NAME 'bump0'
>  TYPE PIXMAP
>  IMAGE 'images/bump-green-00.gif'
> END
>
> #This is the layer I currently use for rendering all with the same symbol
> LAYER
>  NAME 'GRAPHIC2'
>  TYPE POINT
>  MINSCALE 0
>  MAXSCALE 55000000000
>  STATUS ON
>  FEATURE
>  END
>    CLASS
>     STYLE
>    SYMBOL 'images/bump8grn.GIF'
>   END
>  END
> END
>
> #PHP Code
>
> //arr is an array with data like
(lat,long,heading,lat,long,heading,etc...)
>  $pos=0;
>  $heading=-1;
>  for ($i=0; $i < $size/3; $i++) {
>   //
>   $oShp=ms_newShapeObj(MS_SHAPE_LINE);
>   $oLine=ms_newLineObj();
>                 // do this after the first point
>   if ($pos>0) {
>    if ($arr[$pos+2] <> $heading) {  //detect heading
> change
>     $heading = $arr[$pos+2];
>     $mysymbol=$gpoMap->getSymbolByName
> ("bump".$heading);  //load this heading's symbol from map file
>     $myClass = $dummylayer2->getClass(0);
>     $mystyle = $myClass->getstyle(0);
>     $mystyle->set("symbol", $mysymbol);
>    }
>    $oLine->addXY($arr[$pos+1],$arr[$pos]);
>
>    $oShp->add($oLine);
>    $dummylayer2->addfeature($oShp);
>
>   }
>   else  //do this for the first point
>   {
>    $oLine->addXY($arr[$pos+1],$arr[$pos]);
>
>    $oShp->add($oLine);
>
>    //Set the first point label
>    $oShp->set("text",$Label);
>
>    $dummylayer->addfeature($oShp);
>   }
>   $pos=$pos+3; //skip three places to the next point
>   $oShp->free;
>   $oLine->free;
>  }



More information about the mapserver-users mailing list