[Mapserver-users] can I use different symbols in thesamedynamiclayer?
Vinko Vrsalovic
vinko at cprsig.cl
Mon Sep 29 08:36:16 PDT 2003
On Mon, Sep 29, 2003 at 01:40:25PM +0200, Frieso ter Haseborg wrote:
>
> Hi,
>
> >One layer is a collection of figures of some type, a class defines
> >how a certain figure will be drawn based on a certain attribute
> >(CLASSITEM) or characteristic, so, to draw differently two or more
> >features on one layer, you must add as many classes as different
> >colors (or symbols, etc) you need.
> Sounds good to me, but why can I change the symbol on using only ONE
> class?
I don't know. I've never done it that way, maybe it's a useful bug :-)
> What I did:
> [...]
> $newclass = ms_newClassObj($layer); // create a new class
> $originalclass = $layer->getClass(0);
> $newclass->set('name','new class');
> $newclass->set('type', $originalclass->type );
> $newclass->set('status', $originalclass->status ); // retrieve data
> from previous class
> $newclass->set('minscale',$originalclass->minscale ); // provide new
> class with this data
> $newclass->set('maxscale',$originalclass->maxscale );
> $newclass->label=$originalclass->label; // transfer
> label-information //THIS FAILES!
I'd do this $newclass->label->set("font",$originalclass->label->font),
etc.
> So one problem solved and another one found?
>
>
>
> >Another way to do this is through addFeature(), this is the way i do it
> >because i usually need to add polygons and lines besides points, i'll
> >send an example if needed.
> Yes a example would be a great help!
>
$add = $this->figures->getByType('polygon');
for ($i=0;$i<count($poly);$i++) {
$line = ms_newLineObj();
while ($pt = $poly[$i]->getPoint()) {
$line->addXY($pt['x'],$pt['y'],0);
}
$shp = ms_newShapeObj(MS_SHAPE_POLYGON);
$shp->add($line);
$shp->set('text',$poly[$i]->getId());
$shp->set("classindex",0);
$lyr->layer->addFeature($shp);
}
--
Vinko Vrsalovic <el[|- at -|]vinko.cl>
http://www.cprsig.cl
More information about the MapServer-users
mailing list