[Mapserver-users] queryng and displaying a lot of elements

Andres Garcia listamapserver at hotmail.com
Fri Dec 27 15:29:25 EST 2002


Hello everybody!!

I have information about the layer's elements on oracle. So I can made a 
very complex query and get some ids. These ids will be passed to the map to 
draw the elements. By now, i'm using the next code:

$popplace = array with the ids of the elements from the query to oracle

$layer = $mapa->getLayerByName("popplace");

for ( $i=0; $i<count($popplace); $i++) {
  $layer->set("filteritem","popplace_");
  $layer->setFilter("\"$popplace[$i]\"");
  @$layer->queryByAttributes(MS_SINGLE);
  if ( $layer->getNumResults() > 0 ) {
    $layer->open($mapa->shapepath);
    $result = $layer->getResult(0);
    $shape = $layer->getShape($result->tileindex, $result->shapeindex);
    $shape->set("classindex","1");
    $resultados[] = $shape;
    $layer->close();
  }
}
$shapes_resultados["popplace"] = $resultados;


Now i can draw the elements that are stored in the $shapes_resultados array 
using tihs (inside a loop) :

$shape->draw($mapa,$layer,$image,"",".");

I'm using the demo maps by now, but my real life shape files will be bigger. 
Whats the best option to draw the results?? How can i improve that code  
(with indexes maybe, i dont know nothig about that kind of indexes .idx)??

thanks in advance!!!

_________________________________________________________________
MSN. Más Útil Cada Día http://www.msn.es/intmap/




More information about the mapserver-users mailing list