query by attributes / queryByShape / queryByPoint
Shashi Gireddy
gireddy at GMAIL.COM
Tue Sep 13 09:11:24 PDT 2005
Hi everybody,
I am trying to do query on my maps, I am neither getting erros nor my
query results, I tried queryByShape, queryByRectangle, queryByPoint
and then queryByAttribute..... none of them worked,
here is my code for query by attribute:
if($_REQUEST['qry'])
{
$layerObj = $map->getLayer(0);
echo $layerObj->name;
$layerObj->open();
/* $shp1=ms_newShapeObj(MS_SHAPE_POINT);
if($shp1=$layerObj->getShape(1,4))
echo $shp1->index;
else echo "sorry"; */
$layerObj->queryByAttributes('pop_1990','[pop_1990]' >
1000, MS_MULTIPLE);
$layerObj->getItems();
echo $layerObj->getNumResults();
$layerObj->close();
}
the output tht i get is: counties0 that means $layerObj is perfect and
its name is counties
0 means it did return 0 results..... which is wrong.
It gave the same answer when i tried query by Shape here is the code..
$layerObj->open();
$shapeObj = $layerObj->getShape(-1, 10);
$st = $layerObj->queryByShape($shapeObj);
$map->prepareQuery();
if($st == MS_SUCCESS){
$shapefound = $map->queryByIndex(1, -1, 10, MS_FALSE);
$imageObj = $map->drawQuery();
echo $shapefound."FOUND";
}
//$image_urlx=$image->saveWebImage(MS_PNG,1,1,0);
$image_urly=$imageObj->saveWebImage(MS_JPG,1,1,0);
$layerObj->close();
echo "<BR>".$image_url;
echo "<BR>".$image_url1;
help appreciated..
Thanks alot in advance.
Thank you,
shashi.
More information about the MapServer-users
mailing list