[mapserver-users] problem with processquerytemplate and large selection sets

Bistrais, Bob Bob.Bistrais at maine.gov
Fri Apr 19 13:29:10 PDT 2013


I've run into a problem when running queries with a large number of results (in my test case, over 1000 records, point locations, shape file).  After some testing, I found the problem wasn't the query itself- I did a queryByAttributes and it told me the records were selected within a couple seconds.  On further investigation, the problem seems to be when calling the processquerytemplate method.  The process takes a long time, often timing out beyond 30 seconds.  I am also suspicious that the result set is getting processed in such a way that we are reiterating over records.

Has anyone had a similar problem, and are there any suggestions ?

Here is a code excerpt, I hope it's enough to help...

$layer->queryByAttributes($queryItem,$queryExp,MS_MULTIPLE);
$numResults = $layer->getNumResults();
$layer->open();

for($i=0;$i<$layer->getNumResults();$i++){
    $shape=$layer->getShape($layer->getResult($i));
    $foundShapes[] = $shape;
    $fields = array();
    array_push($fields, 'wkt_geometry text');
    foreach($attributes as $attribute) {
                    array_push($fields, $attribute.' text');
    }
    array_push($results,$map->processquerytemplate(array(), false));

$layer->close();


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130419/4f48fdcf/attachment.html>


More information about the mapserver-users mailing list