Mapscript Question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Mapscript Question

Pearson, Gregory

I am doing a layer search using the method queryByAttributes and want to know if I can get the map coordinates from the result. So far, I haven’t seen anything in the API documentation that supports this. Is this possible?

 

Greg

Reply | Threaded
Open this post in threaded view
|

Re: Mapscript Question

Moen, Paul T.
Re: [UMN_MAPSERVER-USERS] Mapscript Question You could try to use the bounds and loop through the results.

    $test=@$qlayer->queryByAttributes($item,$temptest,MS_MULTIPLE);
    if ($test == MS_SUCCESS) {
            $minX=-1;
            $minY=-1;
            $maxX=-1;
            $maxY=-1;
            for ($ind = 0;$ind<$qlayer->getNumResults();$ind++) {
                $result = $qlayer->getResult($ind);
                $shpindex = $result->shapeindex;
                $tilindex = $result->tileindex;
                $shptemp = $qlayer->getShape($tilindex,$shpindex);
                $rec = $shptemp->bounds;
                if ($minX == -1 or $minX > $rec->minx) $minX=Round($rec->minx);
                if ($minY == -1 or $minY > $rec->miny) $minY=Round($rec->miny);
                if ($maxX == -1 or $maxX < $rec->maxx) $maxX=Round($rec->maxx);
                if ($maxY == -1 or $maxY < $rec->maxy) $maxY=Round($rec->maxy);
            }
    }

On 2/28/08 2:23 PM, "Pearson, Gregory" <[hidden email]> wrote:

I am doing a layer search using the method queryByAttributes and want to know if I can get the map coordinates from the result. So far, I haven’t seen anything in the API documentation that supports this. Is this possible?
 
Greg



Paul