[mapserver-users] Highlighting query results

Steve Lime Steve.Lime at dnr.state.mn.us
Tue Sep 2 11:11:33 PDT 2008


MapServer supports what's called a query map. It basically replaces the color of the top-most
style for a layer with one defined in the query map object (default is yellow). Typically in MapScript
you'd do:

  a_layer.queryByAttributes(m_map, null, a_query, 1);
  img = m_map.drawQuery();

You can of course get fancier and step through the result set by hand but I wouldn't recommend 
starting that way.

Steve
  

>>> On 9/2/2008 at 9:14 AM, in message
<E1KaWeU-0008jG-00.shurhenv-mail-ru at f10.mail.ru>, shurhen <shurhenv at mail.ru>
wrote:
> Hi!
> 
> I'm newbie in mapserver :) 
> 
> I need to highlight query results. I wanna select object by attribute and 
> then highlight it. But I've not found any information how can I do this. Most 
> of GIS have possibility to highlight selected objects, therefore I suppose  
> what MapServer has this ability too. "Selected" means to highlight object 
> when I click at it, and to return to its previous color when I click at 
> another object. 
> I've found similar question
> 
> http://mapserver.gis.umn.edu/data2/wilma/mapserver-users/0309/msg00063.html 
> 
> but unfortunately it remains without any answer :(
> 
> If there is no way except to color selected object manually, please help me 
> to do this too.
> 
> Here is Mapscript code example based on the info what I found on this site:
> 
> a_layer.queryByAttributes(m_map, null, a_query, 1);
>             using (resultCacheObj results = a_layer.getResults())
>             {
>                 if (results != null && results.numresults > 0)
>                 {
>                     a_layer.open();
>                     for(int i = 0; i < results.numresults; i++)
>                     {
>                         resultCacheMemberObj a_result = 
> results.getResult(i);
>                         shapeObj a_obj = 
> a_layer.getFeature(a_result.shapeindex, a_result.tileindex);                  
>      
> 
> 
>                         //           WHAT NEXT??
> 
> 
>                     }
>                     a_layer.close();
>                 }
>             }
> 
> PS Sorry for my English, but I hope you've understood me
> 
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org 
> http://lists.osgeo.org/mailman/listinfo/mapserver-users




More information about the MapServer-users mailing list