Highlight Features

robert fritz robert-fritz at WEB.DE
Mon Aug 29 00:28:56 PDT 2005



Hello Rob,

to hilite a single feature you can try this :

- create a new class based on an existing class
- set an expression for this class, something like::

$strExpression = "('[".$DBaseFieldname."]' = '".$ObjectID."')"; 
- set a style for the new class
- and then move the new class on top 

Ex.:

$objLayer = $objMap->getLayerByName($hlLayer);
$objClass0 = $objLayer->getclass(0);
//create a new class based on a existing one::
$objClass1 = ms_newclassobj($objLayer,$objClass0);

 
$objClass1->setExpression($strExpression);
//create a style object for the new class
$objStyle = $objClass1->getStyle(0);
$objStyle->color->setRGB(255,255,0);
$objStyle->outlinecolor->setRGB(0,0,0);

//move the new class on top
$numClasses = $objLayer->numclasses;
for($i=0;$i<$numClasses;$i++)
{
 $objLayer->moveclassup($numClasses-$i);
}

draw the map 
....
$objImage=$objMap->draw();

Robert

 

 

 


Hello All,Using PHP/Mapscript 4.4. Trying to highlight feature in polygon layer,such as subdivisions. I use: $layer->setFilter(""); $sFilter = "('[subdivname]' = '$sSubDivsion')"; $layer->setFilter($sFilter);PROBLEM: ONLY THAT SPECIFIC FEATURE IS DRAWN. If I use: $sFilter = "('[subdivname]' != '$sSubDivsion')";PROBLEM: ALL FEATURES DRAWN EXCEPT ONE OF INTEREST, WHICH IS OK EXCEPT INPLACES WHERE THE BOUNDARY OF THE FEATURE OF INTEREST HAS NO SURROUNDINGPOLYGONS. WHEN THIS IS THE CASE, THE BOUNDARY OF FEATURE IS NOT SHOWN.QUESTION: HOW DO I DRAW ALL FEATURES WITHIN POLYGON LAYER AND ALSOHIGHLIGHT THE FEATURE(S) OF INTEREST IN A DIFFERENT COLORThanks, Rob


Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179 
 
 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050829/a86044c5/attachment.htm>


More information about the MapServer-users mailing list