Highlight Features
Armin Burger
armin.burger at GMX.NET
Sun Aug 28 07:10:39 PDT 2005
Rob,
the easiest way would be using the querymap function like
...
// Execute a query (here an attribute query)
$queryString = "('[subdivname]' = '$sSubDivsion')";
$your_layer->queryByAttributes('subdivname', $queryString, MS_MULTIPLE);
// Draw map
$mapImg = $map->drawQuery(); // instead of $map->draw()
...
You can specify colors for highlighting in a QUERYMAP tag in the map file.
A more flexible solution (but more complex) is to add an additional
layer containing only the selected feature and add this layer to the map
on top of the base layer:
1) create a new layer
2) get the shape index of the feature to be drawn and then add
it to the new layer
3) define the styles/colors etc for this feature
If you're interested I can send you some code for this latter version.
Armin
Rob Sosnowski wrote:
> 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 IN
> PLACES WHERE THE BOUNDARY OF THE FEATURE OF INTEREST HAS NO SURROUNDING
> POLYGONS. WHEN THIS IS THE CASE, THE BOUNDARY OF FEATURE IS NOT SHOWN.
>
>
> QUESTION: HOW DO I DRAW ALL FEATURES WITHIN POLYGON LAYER AND ALSO
> HIGHLIGHT THE FEATURE(S) OF INTEREST IN A DIFFERENT COLOR
>
> Thanks, Rob
>
>
More information about the MapServer-users
mailing list