[Mapserver-users] multiple queries, hilite in different color

Nikolai Vladychevski niko at isl.net.mx
Mon Feb 2 08:20:58 PST 2004


Hi, 

I want to select each found item on a layer with different color. This
problem is due to when quering multiple layers the 'state' layer hilites
with the same color that found points or lines on other layers and the
result (at close views) is all shown in one color , the user can't
distinguish anything. 

This is my code: 

if ($mode eq "nquery" || $mode eq "query") {
  my $queryPt=new mapscript::pointObj();
  my ($x,$y)=&click2map($map,$xclick,$yclick,$imgext_obj);
  $queryPt->{x}=$x; $queryPt->{y}=$y;
  $map->prepareQuery();
  if ($mode eq "nquery") {
      my $layer=$map->getLayerByName("regiones");
      $layer->{status}=$mapscript::MS_OFF;
      my $layer=$map->getLayerByName("estados");
      $layer->{status}=$mapscript::MS_OFF;
      my $layer=$map->getLayerByName("municipios");
      $layer->{status}=$mapscript::MS_OFF;
      $res=$map->queryByPoint($queryPt,$mapscript::MS_MULTIPLE,0);
  } else {
      $res=$map->queryByPoint($queryPt,$mapscript::MS_SINGLE,0);
  }
  for (my $lidx=0;$lidx< $map->{numlayers};$lidx++) {
      my $l=$map->getLayer($lidx);
      print "layer $l->{name} has $l->{resultcache}->{numresults}
results<br>";
      my $result=$l->getResult(0);
      .... and display results 

The layers "regiones", "estados" and "municipios" are polygons, wich I want
to be hilited in some other color than other layers. How can this be done?
Right now I am turning them off. 

I have been thinking, if queryMapObj would be related to layer, I could
change the color of the found items, but since it is not possible, I need to
query each group of layers separately and find a way to merge 2 images
resulted from each query. 

Any ideas? 

Thanks in advance
Nikolai 




More information about the MapServer-users mailing list