PHP/MapScript: How to change the color of a point?

Bart van den Eijnden (OSGIS) bartvde at XS4ALL.NL
Thu Jul 27 10:30:58 PDT 2006


Create a class and a style like eg:

    $oClass = ms_newClassObj($oLayer);
    $oStyle = ms_newStyleObj($oClass);

    $aColor[0] = 0;
    $aColor[1] = 0;
    $aColor[2] = 0;
    $oStyle->color->setRGB($aColor[0], $aColor[1], $aColor[2]);

And set the expression of the class with set Expression:

$oClass->setexpression( '([id] = '.$aRec['id'].')' );

Best regards,
Bart

Alexandre Abramides wrote:

>Anyone?   I would really apreciate some help.
>
>Thanks,
>Alexandre.
>
>----- Original Message ----- 
>From: "Alexandre Abramides" <alexandre at ACQUASOFTWARE.COM.BR>
>To: <MAPSERVER-USERS at LISTS.UMN.EDU>
>Sent: Thursday, July 20, 2006 5:16 PM
>Subject: [UMN_MAPSERVER-USERS] PHP/MapScript: How to change the color of a
>point?
>
>
>  
>
>>This is what I do to draw a point:
>>
>>  $point = ms_newPointObj();
>>  $point->setXY($x,$y);
>>  $line = ms_newLineObj();
>>  $line->add($point);
>>  $feature = ms_newShapeObj(0);
>>  $feature->set("text"," ");
>>  $feature->add($line);
>>  $layer = $map->getLayerByName($layer_name);
>>  $layer->addFeature($feature);
>>
>>What I need is to change the color of the point (RGB) according to some
>>condition, can anyone help me?
>>
>>Alexandre.
>>
>>    
>>
>
>
>  
>


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
http://www.osgis.nl



More information about the MapServer-users mailing list